Updated

Ryan Vogelsong has had a hard time on the mound lately, especially against the Arizona Diamondbacks.

The San Francisco left-hander lasted just 3 1-3 innings on Sunday in the Diamondbacks' 10-2 rout of the Giants, allowing seven runs, six earned. Just two starts earlier, he also went 3 1-3 innings against the Diamondbacks, giving up six runs.

He has given up 20 runs in 17 2-3 innings in his last four starts and is mystified by his lack of success.

"I feel healthy, I feel strong, my stuff is there," Vogelsong said. "I'm just not getting the results."

So he expects it to get better?

"It's got to," he said. "I don't see how I can keep throwing the ball the way I am and keep getting the results I am. I just have to keep fighting though it and it will turn around. It has to."

The one-sided loss aside, the Giants still took two of three from Arizona after taking two of three from Colorado. San Francisco didn't lose any ground in the standings, remaining 7 1/2 games up on the Los Angeles Dodgers, who lost 5-2 in 12 innings to St. Louis.

"It was a good road trip," the Giants' Buster Posey said. "We have to come away happy taking four of six on the road and now we get to go home for 10 games."

Arizona's rookie starter Patrick Corbin (6-7) pitched eight innings and drove in four runs with a triple and single.

Justin Upton had a solo homer and two-run double as the Diamondbacks averted a three-game sweep.

Corbin entered the game batting .071 (2 for 28), then struck out in his first at-bat against Vogelsong.

"My first at-bat he threw two heaters in and I just stood there, didn't even take the bat off of my shoulder," Corbin said. "He got to two strikes again and that's just what I was sitting on. I just put the bat on the ball and it got by them."

Corbin scattered eight hits, striking out five and walking one.

Vogelsong couldn't explain the game's outcome.

"I can't say I missed location today. The only pitch I missed location was Upton's first double," Vogelsong said. "On Corbin's (triple) I just spotted it in the middle. The balls came out good that is why it is getting perplexing. My stuff is there. It just doesn't make much sense right now."

Vogelsong has allowed 34 in his last seven starts.

"His stuff is good, he is just going through a tough period," San Francisco manager Bruce Bochy said. "He has been through it before and he will come out if it."

The victory keeps Arizona 4 1/2 games out in the wild-card race.

Arizona's fourth-inning eruption broke a 2-2 tie.

It started when Giants shortstop Joaquin Arias muffed Paul Goldschmidt's grounder. Vogelsong struck out Ryan Wheeler for the second time, but Cody Ransom doubled off the wall in center to put runners at second and third. Gerardo Parra was walked intentionally to bring up Corbin, who was batting .069 (2 for 29).

On a 1-2 pitch, Corbin hit one down the line to the right field corner, clearing the bases and finishing with a head-first dive into third.

Vogelsong walked Adam Eaton and was through for the day. Shane Loux relieved Vogelsong and Aaron Hill doubled both base runners home to make it 7-2.

Upton homered for the second game in a row, a solo shot to left in the sixth. Corbin got his fourth RBI with a broken-bat, bloop single in the seventh.

The four RBIs were the second-most by a pitcher in Diamondbacks' history. Micah Owings had six against Atlanta on Aug. 18, 2007.

The Giants scored in the first when Angel Pagan opened the game with a double. He was sacrificed to third by Marco Scutaro's bunt and scored on Posey's two-out single.

Arizona went up 2-1 in the third on Upton's booming two-run double off the overhang in right-center, a foot or less shy of a home run. Vogelsong retired the first two batters in the inning but walked Eaton and gave up a single to Hill to set things up for Upton, who also had a solo home run in the sixth.

San Francisco made it 2-2 in the fourth when Posey led off with a walk and Hunter Pence was hit by a pitch. Posey scored on Brandon Belt's two-out double.

NOTES: The Giants go home for a four-game series with Colorado. LHP Madison Bumgarner (14-10, 3.32 ERA) goes for San Francisco in Monday's opener and Jhoulys Chacin (2-5, 4.86) for the Rockies. ... Arizona has Monday off. The Diamondbacks open a three-game series at home with San Diego on Tuesday, RHP Ian Kennedy (13-11, 4.21) going for Arizona, LHP Eric Stults (6-2, 2.54) for the Padres. ... The Giants haven't lost a series on the road since dropping two of three at Pittsburgh July 6-8. ... The Diamondbacks had not scored more than four runs in 12 straight home games, tying a club record. ... San Francisco used eight pitchers.