Anthony Rizzo and Starlin Castro homered while Edwin Jackson pitched eight strong innings as host Chicago avoided a four-game sweep by beating Milwaukee.

David DeJesus added two hits and three RBIs for the Cubs who were in danger of being swept at home by the Brewers for the first time since 2002.

Jackson (7-11) limited Milwaukee to one run on eight hits losing the shutout on Jonathan Lucroy's RBI double in the eighth. Jackson has allowed three or fewer earned runs in six straight starts.

Rizzo opened the scoring with a two-run blast deep into the bleachers in center field with two outs in the third. The Cubs tacked on two more runs in the fourth as Castro drove a 1-0 changeup out to left-center and DeJesus picked up an RBI on an infield single.