"He's so young, but we're seeing him progress right before our eyes, and it's sure great to see," Astros manager Brad Mills said.
The Brewers' Yovani Gallardo, 10-0 in his last 10 starts against the Astros, earned the win with his own solid performance on the mound.
Gallardo didn't make anything of his stellar numbers against Houston.
"They made me work today," Gallardo said. "It seemed like it was a lot of 3-2 counts, and they were taking some good pitches and fouling off some good pitches. They've got some pretty good hitters."
The right-hander pitched 7 2/3 innings, allowing nine hits and three runs. He struck out eight, walked two and earned his 11th win of the season.
In the ninth, the Astros rallied against reliever Kameron Loe. Fernando Martinez led off the inning with a single. Pinch-hitter Brian Bogusevic reached on a throwing error by Loe. Both runners moved up a base on a wild pitch, giving the Astros a chance to tie the game with a two-out single. But Marwin Gonzalez grounded out to end the game.
Milwaukee took the lead for good in the fifth inning.
Jean Segura's speed started the inning for the Brewers. He beat Gonzalez's throw to first to reach on an infield single, moved to second on a sacrifice by Gallardo and scooted to third on a fielding error by Gonzalez, which also allowed Norichika Aoki to reach first base.
With Rickie Weeks at the plate, Aoki stole second, giving the Brewers two runners in scoring position. Segura charged home on Weeks' ground ball to third baseman Scott Moore and beat the throw to the plate. Ryan Braun grounded out to score Aoki and give the Brewers a 3-1 lead.
"I know that Gonzi feels terrible, but we've talked many times about giving Major League teams extra outs, and that's exactly what we did that inning, and that's what hurt us," Mills said. "We wound up losing by two."
The Astros got one back in their half of the fifth after singles by Chris Snyder and Tyler Greene. Snyder scored on Gonzalez's grounder to first baseman Corey Hart, who decided not to throw home with Gonzalez in the way.
Hart got the run back, blasting his 22nd homer of the season on an 0-1 dealing from Lyles to lead off the sixth, giving the Brewers a 4-2 lead.
Lyles worked a scoreless seventh before exiting. He induced 16 ground-ball outs and just one fly-ball out in the game.
"We attacked the zone and got a lot of ground balls," Lyles said. "A couple balls fell in through some holes, but I think me and Chris did a pretty good job of getting good quick outs."
Snyder doesn't always catch Lyles, but he's watched him develop as a pitcher over the season.
"I think he's gaining confidence, which is huge for him," Snyder said. "He knows he can go out there and compete every five days."
Mills doesn't look at Lyles' 2-9 record as any indication of how he's pitched this season.
"The focus is not getting him to focus on that right now, but how he's pitching and continue to throw and the progress he's making," Mills said. "Those wins will come as he continues to throw the ball just like he did today."
The right-hander said he's felt better in his last few starts and that he's moving in the right direction.
In the eighth, the Brewers added an insurance run off reliever Mickey Storey on Martin Maldonado's RBI double. The Astros added a run in their half of the frame behind three singles to pull within two, but couldn't convert in the ninth.
With victories in the first two games of the series, the Astros captured their first series victory since winning two of three from the Indians from June 22-24.
"I think that's what everybody here needs to realize," Snyder said. "We just need to finish up strong. Everybody needs to keep playing and having fun and keep it going."