Castro's leadoff homer against Chisox starter John Danks broke a 2-2 tie, and one out later, Carter followed with a mammoth solo blast to left.
Brandon Barnes provided what turned out to the game-winning run with an RBI double in the next frame for the Astros, who won a second straight against Chicago.
Lucas Harrell (5-7) notched the decision after yielding three runs on seven hits over 6 2/3 innings, walking one and striking out seven.
Danks (1-3) took the loss, giving up four runs on five hits in six innings.
Adam Dunn hit his 18th homer for Chicago.
NBC reportedly holds celebs hostage to Jimmy Fallon's show
Kim Kardashian, Kanye West reportedly set wedding date