It's only the second time this season the Astros have hit four homers in a game (June 10 at the White Sox). Wallace and Castro went back-to-back in the fifth, Castro homered again in the eighth and Altuve put them ahead, 7-4, in the ninth. All four were solo shots.
"It changes the momentum a little bit when we drive the ball," Wallace said. "Even though it counts for the same if we hit singles and score guys, it just changes the momentum a little bit. It's part of our game that's developing, guys are starting to drive the ball a little more consistently."
What made the power surge even more unlikely is that it started against Brewers ace Yovani Gallardo, who has dominated the Astros in his career. The right-hander allowed eight hits and five runs (four earned) in six innings to fall to 3-1 against Houston this year and 13-3 in 16 career starts.
"I don't know if I would ever say we're comfortable against him," Wallace said. "He's a No. 1 and he's got real good stuff and he attacks you, but I think sometimes you have to grind him out and hope he makes a mistake, and when he does, take advantage of it. I think we took advantage of some of the mistakes he made."
The Brewers had won Gallardo's previous 11 starts, a streak that began with his first outing after the team traded Zack Greinke. Milwaukee hadn't lost a game started by Gallardo since July 26 against the Nationals.
"That's the first time I've felt like that in a while," Gallardo said.
The loss put the Brewers on the verge of being eliminated from the playoffs. A combination of one Brewers loss or one Cardinals win would put them out of the National League Wild Card hunt.
"Until we're eliminated, we'll keep going at it, but we didn't play well today," manager Ron Roenicke said. "We didn't pitch well. We gave them a couple of runs in the fourth inning with the defense. We did a nice job coming back, making it interesting with the offense, but it just wasn't a well-played game."
Astros starter Edgar Gonzalez (3-1) picked up his third road win in his five starts with the Astros this year, allowing four hits and three runs in 5 2/3 innings. He left his previous start last Friday with a strained hamstring, but it wasn't an issue.
"I'm so excited we got the win, and that's the only thing that mattered," Gonzalez said. "I felt good the whole game. I was working on that [hamstring] every day with the treatment, and on Tuesday I threw a bullpen and the pain's gone. Thankfully everything was good."
Castro, the former first-round pick who missed all of last season following knee surgery, is hitting .289 with five homers and 20 RBIs in 159 at-bats since May 21.
"You're hoping that's the kind of guy we're looking for down the road, a guy that can hit 15-20 home runs," Astros interim manager Tony DeFrancesco said. "Altuve, I can't say enough about the kid. He comes to play and had a big extra run there in the last inning. Wallace is going to have to hit some if he's going to be a Major League first baseman."
Castro's homer off Francisco Rodriguez in the eighth put Houston ahead, 6-3, but Aramis Ramirez tripled off Rhiner Cruz in the bottom of the inning to score a run and make it 6-4. That prompted DeFrancesco to summon closer Wilton Lopez for a four-out save.
"In that eighth inning, I really didn't want to go to Wilton for five outs, and I tried to sneak through it," DeFrancesco said.
The Brewers scored twice off Lopez in the ninth, including an unearned run because of an error on third baseman Matt Dominguez, but the closer got Norichika Aoki to hit into a 6-4-3 double play to end the game.
"They needed a win today and we came in there and we snuck one," DeFrancesco said.