The Cubs ended a two-game skid thanks, in part, to a seven-strikeout performance by Tom Gorzelanny.
Chicago scored three times in both the second and third innings with Soto and Castro doing much of the damage.
Castro had an RBI single in the second and scored on Soto's ninth homer of the season. Both Castro and Soto singled in a run in the third. Aramis Ramirez had a solo homer for the Cubs in the seventh.
Gorzelanny (4-5) held the Dodgers to two runs on six hits in six innings for the victory. John Ely (4-7), who has lost six of his last seven decisions, gave up six runs on five hits in 2 1/3.
Los Angeles right fielder Andre Ethier ran his RBI total to 54 with a two-run, fifth-inning single.