PHOENIX -- A sacrifice bunt by the cleanup batter, spectacular defense by a rookie shortstop and yet another double by Luis Gonzalez.
"This was a big win for us," Gonzalez said. "We beat a pretty tough pitcher."
Vargas threw six innings and Gonzalez scored the go-ahead run after hitting his 534th career double.
Carlos Quentin's broken-bat single brought Gonzalez home from third to break a 2-2 tie in the sixth as the Diamondbacks salvaged the third game of the series.
"To come back, keep grinding, that's a big win for us there," Arizona manager Bob Melvin said. "To pull that one out today after getting behind like that and not having a great feeling in the early innings is a testament to some perseverance."
Gonzalez led off the inning with a double into the right-field corner to tie Lou Gehrig for 26th on the career doubles list. Conor Jackson, acting on his own, moved Gonzalez to third with a sacrifice.
"I don't know if he's ever bunted in his career," Melvin said. "So he's probably one-for-one."
Byrnes homered for the second consecutive game for Arizona, his team-leading 18th of the season. The 440-foot solo shot to left-center with two outs in the seventh made it 4-2.
Vargas (9-8), who threw a season-high 113 pitches, gave up a two-run homer to Lance Berkman in the first, then blanked the Astros for the next five innings. He allowed six hits, struck out six, walked two and hit a batter in his only his third victory in his last 11 starts.
Luis Vizcaino and Tony Pena each pitched a scoreless inning before Jorge Julio entered in the ninth for the Diamondbacks. He allowed Aubrey Huff's run-scoring single, then struck out Morgan Ensberg with runners on first and third for his 14th save in 17 tries.
Pettitte (10-12), 1-5 against Arizona in his career, gave up four runs and eight hits in 7 1/3 innings. He struck out six and walked one.
"We didn't play that bad," Pettitte said. "They just played a good game."
Stephen Drew was 2-for-3 with a double and made a spectacular play to rob Pettitte of a hit in the sixth. The rookie shortstop made a diving stop to his left, then threw the runner out from his knees.
"I can't say enough about Stephen Drew and the plays that he made out there," Byrnes said. "He was the story of the game, man. It was fun to watch. He's really impressed me defensively, with the bat, the way he handles himself and carries himself around the clubhouse. He's been a real big boost for us lately."
Houston finished its trip 4-2.
"I'll take it, but we had a chance to sweep this series and we had a chance to sweep the series in San Diego," Houston manager Phil Garner said, "and we've got to close the door."
Willy Taveras led off the game with a single, then Adam Everett reached on a fielder's choice. Berkman followed and hit a 3-0 pitch 414 feet, just above the home-run line in straightaway center, for his 30th homer of the season.
The Diamondbacks tied it at 2-2 in the third. Chris Snyder drew a leadoff walk, then Drew doubled off the wall in left to put runners at second and third with no outs. Vargas' broken-bat groundout brought home Snyder, then with two outs, Damion Easley's sharp grounder took a bad bounce at third for a base hit that scored Drew.
Vargas escaped a jam in the third after Ensberg walked and Luke Scott singled to start the inning. The Diamondbacks failed to convert Chris Burke's grounder into a double play, but got the out at second while Ensberg went to third with one out. He was stranded when Brad Ausmus hit into a double play.
The Astros loaded the bases in the fourth thanks to Vargas' throwing error that would have been the third out. But Ensberg grounded out to end the threat. Arizona also turned a double play to escape the seventh.
Houston stranded 11 runners.
"We had our chances," Garner said. "We had some really got at bats today. Unfortunately, we just didn't get the hits we needed."
- Arizona OF Jeff DaVanon, who sprained his left ankle sliding into second Saturday night, is expected to be sidelined for at least two games.
- The Diamondbacks again have no left-handers on their staff after they designated LHP Randy Choate for assignment.
- Gonzalez leads the NL with 39 doubles.
- Houston scored 17 runs in the first two games of the series.