The Astros scored six times in the bizarre sixth. San Francisco tied a major league record by hitting three batters in the inning, and also issued four walks.
Houston's winning streak is its longest since a nine-game string in September 2006. The Astros have won 15 of 19 overall.
Randy Wolf (8-10) didn't allow a hit until Fred Lewis' leadoff single in the fourth. He improved to 2-0 in four starts since the Astros acquired him from San Diego on July 22.
Barry Zito (6-15) shut out the Astros on two hits through five innings. But the Giants' 1-0 lead quickly disappeared when Zito and reliever Billy Sadler lost their control.
In all, the Astros' six runs were driven in by two hit batters, two walks and two sacrifice flies.
Ty Wigginton hit a leadoff single, Mark Loretta walked and Miguel Tejada blooped a single to center that loaded the bases. Lance Berkman drew a walk that tied the score and sacrifice flies by Geoff Blum and Reggie Abercrombie made it 3-1.
After Zito hit Humberto Quintero with a pitch to reload the bases, he walked Wolf to force home another run. Sadler took over and hit the first two batters he faced, Wigginton and Loretta, to make it 6-1.
It was the 35th time in major league history a team has hit three batters in one inning, and the first since San Diego was plunked three times by the New York Mets on June 7.
Randy Winn and Bengie Molina doubled in the sixth for the Giants' first run. Winn and Ryan Rohlinger each doubled in the seventh. It was Rohlinger's first major league hit.
Notes:@ Houston also had three batters hit by a pitch in an inning on Sept. 13, 1997, against the Dodgers. ... Rohlinger was called up from Double-A Connecticut earlier in the day. Making his big league debut, he struck out in his first inning, then made a throwing error at third base on Wigginton's leadoff grounder in the bottom half. ... Giants pitcher Tim Lincecum, who left Tuesday's game with a bone bruise on his right knee after taking a line drive off the bat of Brad Ausmus, was walking and feeling better. He said he felt "100 percent" sure he would make his next start Sunday at Atlanta. Manager Bruce Bochy smiled and said "I'd say probably 99.9 percent." ... With 2B Kazuo Matsui day-to-day because of a sore back, Wigginton moved into the leadoff spot. It was only Wigginton's second game in the leadoff role this season. Wigginton's infield single in the sixth gave him a season-high 10-game hitting streak.