"For the most part, these last three games were a lot better than the seven we saw on the road," said Astros manager Brad Mills, whose team dropped two of three to Milwaukee following an 0-7 road trip.
The Brewers rallied to tie the game in the eighth inning and then scored twice in the 10th against reliever Fernando Rodriguez (1-8) to send the Astros to their 10th loss in their past 11 games.
The Astros, who are 0-8 in extra-inning games this year, hit the All-Star break in last place in the National League Central and will open the second half Friday at San Francisco for their first of 10 consecutive games on the road, where they are 9-32.
"We're a young club that's had some experience now with going through this first half," Mills said. "We know it's going to infuse some consistency and the way they've played the last three days, we're going to get that moving in the right direction. Once you get that experience moving in the right direction, you're going to see it continue."
Rodriguez walked the first three batters he faced in the 10th -- including Ryan Braun intentionally -- to load the bases for Corey Hart, who scored Nyjer Morgan with an infield hit. Rickie Weeks followed with an RBI single to right, scoring Braun, to make it 5-3.
"The one I'm really upset about is the pitch to Rickie," Rodriguez said. "He's a great hitter and I thought I was going to be able to get him with that slow curveball, so I took something off it and he shot it through to the right side. Once you walk that leadoff guy, it makes things so much harder, especially with this lineup. You have four or five guys that come right behind him that are tough outs."
The Astros scored three runs on four hits in the first inning against Brewers starter Zack Greinke and went seven innings without a hit after Scott Moore's two-out single in the second. Brewers pitchers sent down 21 of 22 batters until Chris Snyder and Matt Dominguez led off the bottom of the 10th with back-to-back singles.
Jordan Schafer pushed the runners into scoring position with a bunt, but closer John Axford came back to strike out Altuve looking and whiffed Moore on a foul tip to end the game.
"He did a good job and he struck me out," said Altuve, who will carry a .303 batting average into Tuesday's All-Star Game.
Astros starter Jordan Lyles held the Brewers to six hits and two runs in seven innings, bouncing back after allowing nine hits and seven runs Monday in Pittsburgh.
"After [my] last outing, it's especially good to stay away from that big inning I've seen often," Lyles said. "But, overall, my command was OK. It wasn't my best outing command-wise, but overall I felt pretty good and I was excited to get out of that second inning with the bases loaded."
Greinke, who was ejected from his start Saturday after throwing only four pitches, worked three innings and gave up three runs in the first inning. He worked only three innings and will be in line to start a third consecutive game for the Brewers on Friday.
"It wasn't pretty to start, that's for sure," Greinke said. "I felt OK. I just wasn't really locating too good the first inning. And then I got a little better after that. But since I threw yesterday, I didn't have a whole lot of pitches to work with and kind of wasted them all in the first inning."
Weeks homered off Lyles in the third -- his third against the Astros this year -- and Lyles wriggled his way out of a bases-loaded jam in that inning and settled in nicely.
The Astros held a the 3-2 lead until the eighth when Norchika Aori drew a walk against Wesley Wright to start the inning and came around to score on Braun's RBI single to tie the game.
"We're going to put things together," Lyles said. "We're all confident in each other and our abilities, and we've been pitching pretty well and we'll bring the sticks the second half, I'm sure. Overall, we have to put everything together with everyone -- pitching, hitting and fielding. We haven't done that, and it's something we look forward to in the second half and we have to do a better job."