CHICAGO (AP) Anthony Rizzo had three hits and scored three runs, Jorge Soler hit a pinch-hit, 3-run homer and the Chicago Cubs beat the Milwaukee Brewers 9-5 on Monday night.

The Cubs inched closer to a NL playoff berth as their magic number to clinch fell to four. Chicago entered Monday two games behind Pittsburgh for the first wild card berth and has now won six of seven.

Soler's first career pinch-hit home run broke the game open in the seventh inning after the Cubs snapped a 4-4 tie in the fifth with a pair of runs. Starlin Castro, who had two hits and two RBIs for Chicago, drove in a run with a sacrifice fly before Miguel Montero singled in Rizzo, who doubled.

More from FoxSports

Rizzo reached in all five of his at-bats after collecting two walks to go along with his three hits.

Milwaukee's Adam Lind tied the game at 4 with a two-run homer in the fifth inning off Cubs starter Jason Hammel (9-6), who allowed three earned runs over his five innings. He scattered five hits while striking out six and walking one.

After falling behind 2-0, the Cubs responded with three runs in the second inning. Dexter Fowler followed up Castro's RBI double with a two-run double that ricocheted off the second base bag. Fowler was initially called out at second, which would have nullified the go-ahead run from scoring. But the ruling was reversed following a review, allowing the Cubs lead to stand.

Addison Russell's RBI walk in the third inning extended Chicago's lead to two runs. Milwaukee starter Wily Peralta (5-10) allowed four walks and gave six runs over 4 2-3 innings on eight hits. He also struck out two.

The Brewers, who got a home run from Khris Davis in the eighth, strung three singles together and took advantage of a Hammel throwing error in the first to build an early 2-0 lead. Hammel threw wide of first base while attempting to pick off Logan Schafer, which scored Scooter Gennett. Schafer, who also singled, scored on an RBI single by Domingo Santana.

TRAINER'S ROOM

Brewers: RF Ryan Braun (back) missed his third straight game and may miss extended time with the injury. Braun said Monday he plans to undergo back surgery in the offseason. RHP Jimmy Nelson will miss the remainder of the season after being hit in the head by a line drive. Nelson did not sustain a concussion, but a neurologist said Nelson suffered head trauma. Davis returned to the lineup on Monday after missing one game with a sprained right ankle.

UP NEXT

Brewers: RHP Tyler Cravy (0-7, 6.42 ERA) will make his sixth start of the season, pitching in Nelson's place. Cravy suffered his seventh loss of the year in a relief role on Sept. 19 against Cincinnati.

Cubs: RHP Jake Arrieta (19-6, 1.96 ERA) will make his second attempt at becoming the major league's first 20-game winner and the Cubs' first pitcher to reach the mark since 2001 after taking a no-decision in his last outing on Sept. 16.