Yovani Gallardo pitched into the eighth inning, Corey Hart homered and scored twice, and the Brewers avoided a three-game sweep with a 5-3 victory over the Astros.
Gallardo (11-8), who has won 10 straight starts against the Astros, gave up three runs on nine hits over 7 2/3 innings. He walked two, struck out eight and added an RBI single.
"He got it going and ended up throwing fastballs down in the zone really well...the cutter was really good," said Brewers manger Ron Roenicke.
Rickie Weeks, Ryan Braun and Martin Maldonado each drove in a run for the Brewers, who halted an 11-game road losing streak.
Kameron Loe stranded runners at second and third in the ninth inning to secure his first save of the season.
Jordan Lyles (2-9), currently the youngest starting pitcher in the major leagues, allowed four runs -- two earned -- with five strikeouts and no walks over seven innings in the loss. The 21-year-old has dropped five straight decisions.
"He threw the ball really well," Astros manager Brad Mills said. "He's so young but we're seeing him progress right before our eyes and it's great to see."
Marwin Gonzalez with 2-for-5 with a pair of RBI for the Astros, who were looking to secure their first series sweep since taking three games from the Cubs in late May.
Houston notched walkoff wins in the first two games of this set and threatened to do so again in the finale, placing runners on first and second with one out courtesy of a Fernanado Martinez single and a throwing error by Loe on Brian Bogusevic's slow roller. After striking out Tyler Greene, Loe allowed both runners to advance with a wild pitch, but escaped inducing a Gonzalez groundout.
Green and Gonzalez did deliver in the first inning, roping consecutive doubles for a 1-0 advantage.
Gallardo's line drive to right field tied it in the second and the Brewers went on top for good in the fifth.
Jean Segura led off the frame with a single and moved to second on a sac bunt before Gonzalez's error on a Norichika Aoki grounder put runners on the corners.
After Aoki stole second, Weeks hit a chopper to third and Segura slid ahead of Scott Moore's throw to the plate. Aoki moved up on the play and scored on Braun's groundout, making it 3-1.
Gonzalez atoned in part with an RBI groundout in the bottom half, but Hart led off the sixth with his 22nd homer of the season and scored on Maldonado's double in the eighth.
Moore sealed the final margin with an eighth-inning RBI single.
The Brewers' 11-game road losing streak was the second longest in franchise history, falling short of a 17-game stretch on 1970...The last pitcher to win 10 straight starts against a single opponent was Roy Halladay versus Montreal/Washington from 2004-11...Aoki went 2-for-5 and extended his hit streak to 13 games...The Astros were searching for their fourth series sweep of the season.