Jason Heyward hit a go-ahead, three-run homer in the top of the ninth inning, and the Chicago Cubs rallied for a 4-2 win over the host Milwaukee Brewers on Saturday night.

Heyward's blast to right-center field punctuated a wild comeback for the Cubs (27-20), who were two outs away from suffering their third shutout loss in the past four games. Ildemaro Vargas added a solo shot in the next at-bat to give Chicago a two-run advantage.

Milwaukee (20-23) squandered a shot at its third straight victory, which would have matched its longest winning streak of the season. Ryan Braun hit a two-run homer to lead the Brewers at the plate.

Cubs reliever Jason Adam (1-1) got the win after recording the final out of the eighth inning. Adam followed a strong start by Kyle Hendricks, who limited the Brewers to two runs on six hits in 7 2/3 innings.

Brewers reliever Josh Hader (1-2) took the loss after giving up four runs on four hits in one inning. Hader entered the evening with only two hits allowed in 12 2/3 innings on the season.

Newsletter signup for email alerts

Craig Kimbrel picked up his second save with a scoreless ninth for the Cubs. He gave up back-to-back singles to start the inning but escaped the jam.

Milwaukee opened the scoring in the fourth. Dan Vogelbach hit a two-out single to left field, and Braun followed with a two-run shot over the wall in center field.

It was Braun's fourth homer of the season and No. 348 of his career, adding to his franchise record. He has gone deep twice in the past three games.

In the ninth, Javier Baez and Anthony Rizzo singled before Heyward put the Cubs on top. It was Heyward's sixth blast of the season and 150th of his career.

Vargas followed with his first home run since joining the Cubs. The veteran infielder also has played for the Arizona Diamondbacks and Minnesota Twins.

Brewers left-hander Brett Anderson was scheduled to make the start, but he was scratched about two hours before the game because of tightness in his right hip. Manager Craig Counsell said he did not believe the issue was serious, and he hoped Anderson could return to the mound as soon as Monday.

Brent Suter got the spot start for Milwaukee, and threw three scoreless innings, giving up one hit with six strikeouts.