PHOENIX -- Doug Davis pronounced himself back, although how long he stays may be a different story.
"I felt like was gone for a little bit," said Davis, who gave up eight runs in his last start and 13 runs in his previous two. "I was able to control the strike zone a little better and get my curveball over for strikes. When I can do that, I can go from there."
A free agent after the season, Davis has been the subject of trade rumors as the July 31 non-waiver deadline looms, although Arizona general manager Josh Byrnes said before the game that a deal does not appear likely.
"I didn't really think about it at all," said Davis, 5-10 with a 3.76 ERA and 13 quality starts. "I look at it as I'm here to stay. If something else happens, it is out of my control."
Justin Upton hit a two-run home run, his 18th homer of the season, to break a scoreless tie in the fourth inning and added an RBI-single in a four-run eighth inning.
Miguel Montero and Augie Ojeda had two doubles apiece - Arizona had six doubles. Montero extended his hitting streak to eight games. He is hitting .380 in July.
Stephen Drew had a double among his two hits while extending his hitting streak to seven games, and he scored ahead of Upton after leading off the fourth with a double. Drew has 14 hits in his last 29 at-bats.
"It great to get runs early to give Dougie some breathing room," said Upton, who has two three-run homers in the series.
He hit a slider in the fourth inning off Ross Ohlendorf (8-8), who lost his fourth straight road game.
"In that situation, I'm trying to get a ball up in the zone where I can drive it to the outfield," Upton said.
Pittsburgh (43-54) was shut out for the second time in five games and fourth time in its last 16 games. The Pirates have been shut out 10 times, tied with Atlanta for the most in the NL. They were looking for their first consecutive road victories since June 10-11 in Atlanta.
Garrett Jones had two of the Pirates' eight hits. Jones, who leads the major leagues with 10 homers in July, has 10 hits in his last four games.
The Pirates got two runners as far as third base, but Davis got Ryan Doumit to pop out to third base in the first inning and Brandon Moss to ground out to second base in the fourth to end the threats.
"Doug kept up on our toes with four quality pitches. Good pitching plus bat at-bats equals not too much success," Pittsburgh shortstop Jack Wilson said.
Arizona center fielder Gerardo Parra threw out Moss attempting to score from second base to end the second inning. Parra's throw reached catcher Montero on the fly, and Moss was out easily.
"The situation set up perfectly for us. The ball was hit hard, and he was playing shallow. He has a tremendous arm," Arizona manager A.J. Hinch said.
Ohlendorf was making his first career appearance against Arizona, which selected him in the fourth round of the 2004 draft before trading him to the New York Yankees as the principal piece of a three-player package used to acquire Randy Johnson on Jan. 9, 2007.
"For not having his command, he competed very well. It was good learning experience, learning he can pitch without having his best stuff and keep us in the game," Pittsburgh manager John Russell said.
Arizona came within one out of tying a franchise record with its ninth consecutive errorless game before third baseman Mark Reynolds threw wide of first on Jack Wilson's ground ball with two outs in the top of the ninth inning. Arizona played nine straight errorless games from July 19-27, 1999, and from Sept. 17-27, 2005. Pirates' second baseman Freddy Sanchez, who entered the game with 17 hits in 34 previous career at-bats against Davis, was 0 for 4 and struck out three times against Davis. Sanchez is in a 3-for-30 slide, during which his average has dropped to .299. Wilson was 0 for 3 with a walk in his first game back after missing four games with left hamstring tightness.