Astros 7, Brewers 6: Brett Wallace and Jason Castro hit back-to-back homers in the fifth inning and Matt Dominguez had two hits and drove in two runs as visiting Houston dealt a huge blow to Milwaukee's slim playoff hopes.
Castro added a second homer in the eighth - a solo shot - for his first career multi-homer game and Jose Altuve hit a solo homer in the ninth for the Astros, who avoided matching their franchise record of 106 losses set last season.
Ryan Braun had a two-run double and a stolen base for the Brewers, who slipped five games behind St. Louis for the second wild card with five games left. Carlos Gomez hit his 18th home run, a solo shot, for the Brewers.
Astros starter Edgar Gonzalez (3-1) allowed three runs on four hits over 5 2/3 innings to earn his third win in five starts this season. Three relievers bridged the gap to Wilton Lopez, who recorded the final four outs for his ninth save. The Brewers brought the winning run to the plate in the ninth, but Lopez got Norichika Aoki to ground into a double play to end the game.
Brewers starter Yovani Gallardo (16-9) gave up five runs (four earned) in six innings in suffering his first loss since July 26. He had won eight straight decisions.
GAME NOTEBOOK: The Astros had four homers for just the second time this season. The other was June 10 at the Chicago White Sox. … Gallardo went over 200 strikeouts for the fourth consecutive season. He has 204 strikeouts, three shy of his career high set last season. … Braun recorded his 30th stolen base, joining Bobby Bonds, Barry Bonds, Willie Mays, Alfonso Soriano, Ron Gant and Vladimir Guerrero as the only players with consecutive campaigns with 30 homers and 30 stolen bases. It's the 11th time a player has combined 40 homers and 30 steals, and the first since Soriano in 2006.