The Houston bull pen allowed a lone hit over the final three innings to preserve the victory for starter Erik Bedard (3-3).
Lance Lynn (10-2) endured his first loss since May 7, suffering through a fourth inning in which the Astros batted around and scored four times on four hits.
Jose Altuve and Jason Castro singled to open the inning and Chris Carter drew a walk. Lynn then walked Pena on four pitches to force in the first run of the inning.
A fielder's choice grounder by J.D. Martinez delivered another run, after which singles by Brett Wallace and Brandon Barnes brought in the tying and go-ahead scores.
Bedard (3-3) gave up three runs on seven hits with six strikeouts for the victory. Jose Veras put two runners on in the ninth, but escaped with his 16th save.