Keuchel (3-7) stymied the Pirates on four hits, yielding one run while issuing a single walk and striking out seven. The left-handed rookie won his second straight start after dropping seven consecutive decisions.
Hector Ambriz hurled a scoreless eighth inning and Wilton Lopez finished up with a 1-2-3 ninth for his seventh save as the Astros clinched their three-game set.
Castro went 2-for-3, including his decisive, three-run shot in the seventh.
Pittsburgh's Kevin Correia (11-10) struck out nine over six full innings, yielding four runs (three earned) on seven hits while walking one.
Gaby Sanchez socked a solo homer for the Bucs.
Swim Week Miami Beach 2014 [PHOTOS]