PHOENIX -- Doug Davis made one early mistake before cruising to his fourth straight decision.
Davis gave up two hits in the first inning, including Jason Bay's homer that just cleared the fence in left field, but let only one batter reach second base over his final six innings.
"I've said it before and I'll say it again. I was one pitch away from greatness," said Davis, who struck out three and walked three. "It was a fastball middle-in instead of in and they took advantage of it."
Davis hasn't lost since giving up three runs in seven innings in a 3-2 loss to the St. Louis Cardinals on July 5.
Orlando Hudson drove in the go-ahead run in the seventh for the Diamondbacks, who won for the fifth time in six games and have won eight of nine series since the All-Star break.
Arizona is 15-3 since dropping consecutive games July 19-20 in Milwaukee and Chicago, and moved three games in front of San Diego in the NL West.
Brandon Lyon pitched the eighth and Jose Valverde came on in the ninth for his major league-leading 35th save in 40 chances.
Pinch-hitter Jeff Cirillo hit a double off reliever Shawn Chacon (4-3) in the seventh, his first hit for Arizona since he was claimed off waivers from Minnesota on Aug. 3. He went to third on a groundout by Chris Young, and Hudson followed with a hard bouncer through the drawn-in infield, scoring Cirillo and giving the Diamondbacks a 3-2 lead.
"I'm slapping fives and celebrating with guys but I haven't really done anything but be supportive and try to blend in," Cirillo said. "I've faced Chacon in the past and knew the ball would cut a little bit. I just wanted to stay with it."
Arizona manager Bob Melvin said Young's groundout was the key.
"Chris Young goes 0-for-4 today and he has the biggest at-bat of the game," Melvin said. "Somehow C.Y. always ends up in there every game."
Clark extended the lead to 4-2 when he led off the eighth with a home run off the top of the fence in right, his 11th of the year.
Pittsburgh took a 2-0 lead in the first. Freddy Sanchez doubled to left and Bay followed with his 18th homer.
"I think you're foolish if you think 2-0 is going to hold up in this league," Bay said. "Sometimes it is but it's not something you can rest on. We had a couple of chances to add on or even take the lead and we didn't do that."
The Diamondbacks tied it in the fourth against Ian Snell. Eric Byrnes, Chad Tracy and Clark hit consecutive one-out singles to pull Arizona within one, and Chris Snyder drove in Tracy on Arizona's fourth single of the inning to tie the game.
Snell allowed two runs and six hits in six innings, with three walks and seven strikeouts.
Pittsburgh's best chance to score came in the sixth when the Pirates put runners on first and second with no outs, but Davis retired the side on two popups to shortstop and a strikeout.
"That's something that has haunted us all year long," Pittsburgh manager Jim Tracy said. "The sixth inning we have two on and 4, 5, 6 coming up and we can't get the ball out of the infield. We hit the two-run homer in the first and couldn't do anything the rest of the night."
- Hudson made the defensive play of the night when he dived into shallow center with his back to the plate to catch Ronny Paulino's high pop-up.
- Davis won consecutive starts for the first time since May 28 and June 3.
- The Pirates have homered in nine of their last 10 games.
- Snell has struck out seven or more in seven of his 23 starts.