Houston equaled its longest winning streak of the season.
Castro hit a home run to get the Astros going in the fourth inning and they added two runs in the frame on sacrifice flies from Chris Carter and Matt Dominguez.
Those runs brought Houston back from an early 2-0 deficit and the Astros added three more in the seventh.
Houston had already come up with one run in the seventh when a ground ball off the bat of Castro was misplayed for an error by second baseman Howie Kendrick. That led to two unearned runs in the inning.
Dallas Keuchel (2-2) did not walk a batter and gave up two runs on six hits in seven innings to get the win. Jose Veras turned in a 1-2-3 ninth for his 14th save. Veras has earned a save in all but four of the Houston wins this year.
Tommy Hanson (2-2) was tagged with the loss, allowing four earned runs on eight hits in 6 1/3.
Members of Congress to keep receiving porn magazine
Justin Bieber crashes Drake Bell's album release party