SAN FRANCISCO (AP) Kyle Schwarber, Miguel Montero and Starlin Castro all hit home runs in support of another solid outing from Jake Arrieta, and the Chicago Cubs beat the San Francisco Giants 8-5 Tuesday night for their sixth straight win.
Schwarber's towering, three-run homer in the third set the tone for the Cubs, who have won 21 of 25 games to pull 7 1/2 games ahead of the Giants for the second wild-card spot.
Arrieta (16-6) had his 13th consecutive quality start, the longest streak by a Cubs pitcher in 23 years. He allowed an unearned run on four hits in six-plus innings.
Arrieta, who took over the major-league lead for wins, walked one and struck out eight, lowering his ERA to 2.22, second in the NL behind Los Angeles Dodgers' Zack Greinke's 1.67.
Hector Rondon pitched the ninth for his 24th save in 28 chances. He's given up two runs over his last 39 innings (0.46 ERA).
Montero added a two-run homer in the fourth and Castro, who was a triple shy of the cycle, hit a solo shot in the sixth.
Matt Cain (2-4) lasted five innings, giving up six runs and eight hits. He walked two and struck out three. Cain lost his third straight decision and fell to 0-3 over six starts since his last win on July 22.
In nine innings against the Cubs this season, Cain has allowed 11 earned runs and 14 hits.
Arrieta retired the first 10 batters he faced before allowing a single to Matt Duffy, who had two hits. The lone run scored as a result of his throwing error in the sixth. Brandon Belt drove in the run on a groundout.
Andrew Susac drove in three with a double and Gregor Blanco drove in a run in the eighth that pulled the Giants to 8-5.
Arrieta also doubled and scored a run on Brandon Crawford's fielding error, ending a season-best eight-game errorless streak for the Giants.
Castro opened the third with a single, advanced to second on a passed ball and to third on a wild pitch. After Cain struck out Arrieta, Tommy La Stella drew a walk and Dexter Fowler reached on a fielders choice. Duffy threw out Castro at the plate on the play.
Schwarber drove Cain's 1-2 pitch into the right field pavilion to put the Cubs ahead. All of his last four hits have been home runs.
The Cubs moved into a third-place tie in the NL with the Cincinnati Reds, each with 132 home runs. Only the Dodgers (150) and Colorado Rockies (143) have more.
The Cubs improved to 5-0 against the Giants this year.
Giants: LHP Jeremy Affeldt was placed on the 15-day disabled list with a left knee subluxation he sustained while playing with his children on Monday. RHP Mike Broadway was recalled from Triple-A Sacramento to take Affeldt's place. Broadway appeared in six games with the team earlier in the year, recording a 3.68 ERA.
Cubs: RHP Kyle Hendricks (6-5, 4.03) is 4-1 with a 3.43 ERA over his last 10 starts.
Giants: Jake Peavy (3-6, 4.35), a three-time all-star and former Cy Young Award winner, is 8-6 with a 2.81 ERA in 17 starts against the Cubs.