Wade Miley outpitched Matt Garza in eight strong innings, Justin Upton had three RBIs and the Arizona Diamondbacks completed a three-game sweep with a 5-1 victory over the Chicago Cubs on Sunday.

Miley (9-3) retired 20 of the first 21 batters he faced before giving up a homer to Alfonso Soriano in the seventh inning, then worked out of a jam in the eighth with runners on second and third.

Jason Kubel hit a solo homer off Garza (2-6) and Upton broke open a tight game with a two-run single through the left side off Manny Corpas in the eighth inning.

Arizona has won 10 of 11 at home and 12 of 17 overall to creep up the NL West standings.

The Cubs had four hits and were swept in a three-game series by the Diamondbacks for the first time since 2001. Chicago has lost four straight and eight of 11, dropping its record to a baseball-worst 24-48.

The Diamondbacks had been on an offensive tear, scoring 46 runs the previous five games, their most in the same span since 2000. They rolled over the Cubs the series' first two games, including 10-5 on Saturday for their fifth straight game with at least 10 hits.

They couldn't keep it going against Garza, but didn't need to the way Miley had the Cubs flailing.

A nice surprise for the Diamondbacks this season, he has made a case to represent Arizona at the All-Star game and as a candidate for rookie of the year.

Miley entered Sunday's game as the rookie leader in wins and ERA (2.30), and had allowed three earned runs in 22 2-3 innings his previous three starts.

The left-hander was good against the Cubs, too, retiring 14 straight batters before Soriano lifted a homer just over the wall in left-center in the seventh that cut Arizona's lead to 2-1.

Miley found himself in trouble in the eighth after walking Geovany Soto — the second he's issued the last 149 batters — and Darwin Barney's double that nearly cleared the wall in left-center. Miley stranded them by striking out Joe Mather, getting pinch-hitter Luis Valbuena on a line out to shortstop and David DeJesus on a comebacker.

Miley walked to lead off the eighth inning and scored, along with Aaron Hill, when Cubs shortstop Starlin Castro couldn't come up with Upton's hard grounder that put the Diamondbacks up 5-1.

Miley allowed three hits and struck out seven.

Garza was nearly as good.

The hard-throwing right-hander gave up a run in the first inning when he walked leadoff hitter Gerardo Parra and Upton knocked him in with a flare single to left-center.

Garza had the Diamondbacks off-balance over the next four innings, retiring 15 straight batters before Parra hit a two-out triple in the sixth inning. Hill drove him in with an infield single that third baseman Mather had trouble handling just over the base.

Garza's one big mistake came in the seventh inning, when he left an 0-2 pitch up and Kubel hit it out to the pool in right-center — the 43rd all-time to get wet — for a solo homer that put the Diamondbacks up 3-1.

Garza allowed three runs on five hits with seven strikeouts in seven innings.

NOTES: Trevor Bauer, Arizona's top pitching prospect, is expected to be called up and make his major league debut against Atlanta on Thursday. ... Chicago is 3-16 against left-handed starters this season. ... Cubs LHP Travis Wood, the starter Monday against the New York Mets, has allowed three earned runs or less in six of his first seven big league starts. ... Arizona RHP Daniel Hudson, who'll start Tuesday against Atlanta, is 2-0 with a 7.01 ERA in five starts since returning from the DL. He had a no decision his last start, allowing seven runs on 10 hits in four innings of the Diamondbacks' 12-9 loss to Seattle on Tuesday.