Happ was in and out of trouble throughout his time on the mound, but he survived to even his record at 3-3.
Milwaukee had the bases loaded with one out in the third and put runners on second and third with one out in both the fifth and sixth, but could not come up with the clutch hit.
The Astros won their second in a row after losing four straight.
All of the runs came in the fourth inning against Shaun Marcum (2-2), one of them unearned. Jed Lowrie hit a two-run homer and Brian Bogusevic scored later in the frame on a throwing error by center fielder Norichika Aoki.
Jordan Schafer's RBI single completed the scoring.