Justin Maxwell drove in two runs with a single for the Astros, who won for just the second time in their last five games -- one of the losses coming Wednesday in the perfect game thrown by the Giants' Matt Cain.
Wandy Rodriguez (6-4) went six innings for Houston, giving up three runs on six hits with two walks and three strikeouts. Wesley Wright, Fernando Rodriguez and Brett Myers each pitched an inning of scoreless relief and Myers earned his 16th save.
Barry Zito (5-4) went five innings for San Francisco, allowing five runs on five hits with three walks and three strikeouts to take the loss.
Brandon Belt hit a two-run home run and Hector Sanchez drove in one run for the Giants, who have five wins in their last eight games.
Swim Week Miami Beach 2014 [PHOTOS]