Updated

One of the majors' best stories only a month ago, the Pittsburgh Pirates are collapsing to the point they might not even be able to avoid shedding a dubious distinction they've carried for almost two decades.

Alfonso Soriano hit a two-run homer in the eighth inning to give the Cubs the go-ahead runs and Chicago completed a three-game sweep of the Pirates with a 4-2 win on Sunday.

Andrew McCutchen homered and Brock Holt had three hits for the Pirates, who have lost seven of nine and continue their freefall out of contention.

Pittsburgh (72-67) peaked at 16 games over .500 this season but now needs to go 9-14 just to avoid extending their North American major professional sports record of consecutive losing seasons to 20.

"We need to play better — that's it," Pirates manager Clint Hurdle said. "I'm not going to get up here and point fingers or this and that or say this... I'm telling you how I feel — we've got to play batter. And that's it. And they know that."

Entering play on Aug. 9, the Pirates were 63-47, held a 2½- game lead for a wild card spot and sat 2½ games behind NL Central-leading Cincinnati.

Pittsburgh has gone 9-20 since, is 11 behind the Reds and in fourth place in the wild card standings. The Pirates' record is closer to the last-place Miami Marlins than it is to the Reds.

Despite it all, Pittsburgh remains within striking distance of a playoff spot.

"We know we're still in it," cleanup hitter Garrett Jones said. "Our confidence is still high."

Chicago is 6-20 on the road since the All-Star break, with five of those wins coming at PNC Park. The Cubs had lost eight consecutive road games before this series.

Chicago's road sweep was its first since Aug. 1-4, 2010, in Pittsburgh. The Pirates were swept in three games at home for the first time this season.

The Cubs arrived in Pittsburgh on a six-game losing streak and having been outscored 31-10 in getting swept by the Nationals.

"You have to give these guys a lot of credit after what happened in Washington to come in here and do what they did against a really good team," Chicago manager Dale Sveum said.

Soriano followed Anthony Rizzo's leadoff single in the eighth with his second homer in as many days and 28th of the season, sending the first pitch from Jason Grilli (1-6) into the Cubs bullpen in left-center.

Josh Vitters and Anthony Recker each hit solo home runs for the Cubs in the fourth. Recker's homer was the first of his career.

Pittsburgh loaded the bases with one out in the ninth, but Cubs closer Carlos Marmol struck out Gaby Sanchez and got Pedro Alvarez to fly out to left to earn his 18th save.

Joe Mather went 3 for 5 for the Cubs (54-86), who have the majors' second-worst record.

Soriano had six RBIs in the series. His 94 on the season are the most since he put up 95 during his only season with the Washington Nationals in 2006.

The Pirates left 13 men on base — at least one during each of the first seven innings. They stranded two four times, including when Dave Sappelt caught Garrett Jones' sinking liner to right to end the fifth.

"It's a game of inches, and off the bat I thought for sure it was falling," said Jones, "but Sappelt got a good jump on it and made a good play.

"We had some opportunities; we just didn't execute."

McCutchen's homer, his 25th, was his NL-leading 173rd hit. It ended a streak of five consecutive homerless games for the Pirates — their longest of the season.

Grilli earned the loss in relief for the second straight night.

A pair of rookie left-handers started and pitched well but came away with no-decisions.

Making the third start of his career, Chicago's Chris Rusin allowed one run on five hits with four strikeouts in five innings. He left the game in line for his first major league victory, but the Pirates tied it in the seventh when Holt scored on a balk by James Russell (7-1).

Rusin allowed five runs on eight hits in one-plus inning during his previous outing.

Pittsburgh's Jeff Locke gave up the homers to Vitters and Recker in the fourth but overall scattered seven hits over six innings. It was similar to his previous outing Monday against the Astros when he was largely effective but was hurt by a Brett Wallace three-run homer.

"You don't get a whole lot of get-out-of-jail-free cards here (in the majors)," Locke said. "You make bad pitches, hitters are going capitalize, and that happened today and that's what happened last week. They say solo homers never hurt you — but multiple ones, that adds up."

Notes: The Pirates activated RHP Chad Qualls from the disabled list before the game. He retired both batters he faced in the eighth. ... Locke singled in the fifth, his first hit in the majors. ... The Pirates will play three games at the Reds starting Monday. The previous time Pittsburgh played in Cincinnati Aug 3-5, it entered trailing by 3 1/2 games in the NL Central. Five weeks later, the Pirates are in third place and 11 back. ... The Cubs head to Houston, where they will play their final series there against the Astros with both teams part of the National League. The Astros move to the AL West next season.