Fellow left-hander Tyler Skaggs (1-0) made his major league debut in the opener, allowing two runs and three hits over 6 2-3 innings in a 3-2 victory.
Miley (14-8) gave up four singles, struck out five and walked one.
Paul Goldschmidt singled in a run in the first, then doubled and scored in the fourth for Arizona. Aaron Hill had a two-run homer and RBI single in the first game.
Miami's Wade LeBlanc (2-3) gave up three runs, two earned, and five hits in seven innings in the nightcap.
J.J. Putz pitched a scoreless ninth in both games for his 16th and 17th consecutive saves. He has 26 saves in 29 tries on the year.
Justin Ruggiano hit a two-run homer off Skaggs for Miami's only runs in 18 innings on the day. After collecting 35 hits while winning the first two games of the series, the Marlins managed just 10 in the doubleheader.
Skaggs struck out four and walked five.
Jacob Turner (0-1) allowed three runs and four hits in six innings in his first start for Miami since coming to the Marlins in a trade deadline deal with Detroit.
BREWERS 3, CUBS 2
MILWAUKEE (AP) — Ryan Braun hit his NL-leading 34th homer and Yovani Gallardo pitched seven strong innings as Milwaukee completed a three-game sweep of Chicago.
John Axford of Simcoe, Ont., pitched a scoreless ninth to convert his second straight save, returning to his role as the Brewers' closer after he was demoted earlier in the season.
Gallardo (13-8) gave up two runs and four hits, with nine strikeouts and two walks.
Braun hit a solo shot deep to right-centre in the sixth and had an RBI double in the first. With Wednesday's homer, Braun has surpassed the 33 he hit during his 2011 NL MVP season.
David DeJesus and Bryan LaHair homered for Chicago.
Cubs starter Travis Wood (4-10) gave up three runs and six hits in seven innings with a walk and six strikeouts.
BRAVES 5 NATIONALS 1
WASHINGTON (AP) — Kris Medlen pitched seven shutout innings in his latest winning performance and Martin Prado's two-run double proved decisive to help the Braves end a four-game losing streak.
Medlen (5-1) allowed seven hits while striking out seven and walking one in his fifth start of the season. The Braves have won 16 consecutive starts behind the right-hander dating to May 2010.
Atlanta salvaged the three-game divisional series and halted the Nationals' three-game winning streak.
Coming off a shutout in his last outing, Medlen extended his scoreless streak to 21 innings. Since entering the Braves rotation on July 31, the right-hander is 4-0 with a 0.84 ERA.
For the first time in five games the Braves offence scored more than two runs.
Two of the Braves' three ninth-inning runs against reliever Tom Gorzelanny were unearned.
REDS 3. PHILLIES 2
PHILADELPHIA (AP) — Bronson Arroyo allowed three hits in eight-plus innings, and Jay Bruce homered to lead Cincinnati.
Arroyo (10-7), who gave up both runs while striking out four and walking none, retired the first 14 batters before Domonic Brown's two-out homer in the fifth. Brown doubled off the wall in right-centre with one out in the eighth and pinch-hitter Kevin Fransden reached on an infield single leading off the ninth for the other hits off Arroyo.
Arroyo, who was 0-6 with a 9.46 ERA in his last seven regular-season starts against the Phillies, improved to 6-1 with a 3.50 ERA in his last seven starts.
Aroldis Chapman got three outs for his 31st save in 35 chances.
Philadelphia starter Vance Worley (6-9) allowed two runs and eight hits in six innings. It was Worley's third straight loss but the longest outing in four starts for the righty, who has one win in his last seven starts.
ROCKIES 5, METS 2
NEW YORK (AP) — Wilin Rosario hit a tie-breaking homer in the seventh inning, and Colorado won its seventh straight victory at Citi Field.
Rosario also had a sacrifice fly, and DJ LeMahieu drove in a run with a squeeze bunt to help the last-place Rockies win their fourth straight and eighth in 11 games. Colorado will go for a four-game sweep on Thursday, a feat the Rockies accomplished during their previous visit to Queens in April 2011.
Rookie Matt Harvey struck out nine over six innings of three-hit ball, but the Mets lost their fourth straight and fell to 11-27 since the All-Star break, leaving them a season-worst 10 games below .500.
With two runners on in the ninth inning, New York's Ronny Cedeno flied out to the warning track in left to end it.
New York cut it to 3-2 in the eighth. Scott Hairston, who had a sacrifice fly in the first, hit a two-out double off Carlos Torres (2-1) and scored on Ike Davis' single against Matt Reynolds. Will Harris struck out pinch-hitter Jordany Valdespin to preserve the lead.
Rafael Betancourt worked a scoreless ninth for his 25th save in 30 attempts.
Rosario connected off Ramon Ramirez (2-3) leading off the seventh.
CARDINALS 4, ASTROS 2
ST. LOUIS (AP) — Kyle Lohse pitched seven innings of three-hit ball to earn his seventh consecutive win for St. Louis.
Lohse (13-2) gave up two runs and retired his last 14 batters while improving to 7-0 with a 2.21 ERA in 12 starts since he dropped a 3-2 decision against Kansas City on June 15.
The Cardinals have won consecutive games to grab a half-game lead on Pittsburgh for the second wild-card spot in the National League.
Mitchell Boggs worked a scoreless eighth and Jason Motte finished for his 29th save in 34 chances, completing a three-hitter.
Allen Craig extended his hitting streak to a career-best 11 games with a first-inning single and scored a run for St. Louis. Jon Jay, Daniel Descalso and Yadier Molina each drove in a run.
Brett Wallace and Chris Snyder homered for the Astros, who are winless in three games under interim manager Tony DeFrancesco.
Bud Norris (5-11) allowed three runs and seven hits in six innings to fall to 0-10 with a 6.78 ERA in his last 14 starts.
PADRES 4, PIRATES 2
SAN DIEGO (AP) — Andrew Werner allowed two runs over six-plus innings in his major league debut and Carlos Quentin drove in three runs for San Diego.
The Padres swept the three-game series and have beaten the Pirates in 18 of 21 games.
Quentin had three RBIs for the second straight game, including a two-run double in the first inning and an RBI single in the fifth.
Werner, a left-hander who was called up from Triple-A Tucson earlier in the day, allowed four hits, walking four and striking out two.
Brad Brach, Luke Gregerson and rookie Tommy Layne finished the four-hitter. Layne pitched the ninth for his first major league save.
Werner (1-0) was coming off one of his worst starts of the season in which he allowed a season-high eight runs in 4 1-3 innings.
James McDonald (11-6) gave up four runs and five hits over five innings. He walked five and struck out two.
GIANTS 8, DODGERS 4
LOS ANGELES (AP) — Matt Cain pitched seven strong innings and Joaquin Arias homered and drove in a career-high five runs as San Francisco completed its first three-game sweep at Dodger Stadium in five years.
The Giants arrived in Los Angeles trailing the Dodgers by a half-game and they leave with their largest lead in a month. The Dodgers last got swept at home by the Giants April 24-26, 2007.
The Giants avenged a three-game sweep by the Dodgers in San Francisco last month that created a virtual tie atop the division. The Giants are ahead by their biggest margin since a 2 1/2-game lead on July 25.
Cain (13-5) allowed one run and seven hits, struck out five and walked none to win his third straight.
Chris Capuano (11-9) gave up three runs in the first inning before settling down and retiring 13 straight batters. But in the sixth, he gave up three consecutive hits. The left-hander allowed six runs and six hits in five-plus innings, struck out two and walked none.