Carlos Corporan hit a solo home run in the eighth inning for the Astros that tied the score 4-4 and third baseman Matt Dominguez threw out Milwaukee's Scooter Gennett at home in the ninth to force extra innings.
Michael Gonzalez 0-3) was brought in to pitch for the Brewers in the bottom of the ninth and struck out the first two batters he faced. But the second strike-out victim -- Corporan -- reached on a wild pitch.
J.D. Martinez followed with a double to right, with Corporan stopping at third. Pena hit the next pitch into the second-deck of seats beyond right field for his eighth home run of the season.
Hector Ambriz (2-4), who pitched the 10th for Houston, collected the win.
Consecutive errors by the Astros led to three second-inning runs by the Brewers. Houston scored on back-to-back fielder's choice plays in the fifth to get within 3-2. Jonathan Lucroy hit a home run for Milwaukee in the sixth and Dominguez doubled in a run for Houston in the bottom of the inning making the score 4-3.
WATCH: Anchor has laugh attack during 'alligator for beer' report
'Duck Dynasty's Phil Robertson on indefinite hiatus after anti-gay remarks