The Astros were trailing 4-1 after three innings but cut the deficit to one run in the next frame with a two-run blast by Carlos Lee.
Jose Altuve collected a two-out single off Derek Holland (3-3) in the fifth and Maxwell followed with his second homer of the year, putting Houston ahead for good.
Chris Snyder also homered for the Astros, who evened their three-game intrastate rivalry series.
Lucas Harrell (3-3) earned the win after he was victimized by three unearned runs. The right-hander yielded five hits, walked three and fanned six over 5 2/3 innings.
Brett Myers earned his 10th save to nail down the victory.
Holland finished by allowing five runs on five hits over five full frames.
David Murphy hit a three-run, inside-the-park homer for American League West-leading Texas.