Ellis tied the game with a two-out, run-scoring single in the ninth inning off Heath Bell and Ramirez hit the first pitch of the 14th off Collmenter (4-2) just over the wall in right field. Five pitches later, Ellis made it 7-5 with his fourth homer.
Kenley Jansen (3-3) pitched the final two innings for the Dodgers, who used all of their position players and had Zack Greinke, Monday's starter, pinch hit in the 10th inning. Los Angeles has won 15 of 18 to move within 1 1-2 games of the NL West lead after its first sweep of Arizona since 2010.
Arizona went through eight pitchers in the 19th game in the majors to go at least 14 innings this season, according to STATS. There were 20 total last season.
METS 7, GIANTS 2
SAN FRANCISCO (AP) — Former Giants prospect Zack Wheeler pitched seven sharp innings, Marlon Byrd homered again and the New York Mets completed their first sweep in San Francisco since 1994.
Daniel Murphy and John Buck each had two hits and drove in two runs as the Mets won their fourth in a row, including three straight over the slumping World Series champions. The Giants have lost 16 of 19.
Wheeler (3-1), a former Giants' first-round draft pick, took a shutout into the seventh. He allowed one run and three hits overall, striking out five and walking three.
Matt Cain (5-6) lasted less than an inning for the first time in his career, giving up three runs on two hits while getting just two outs. He walked three.
San Francisco dropped a season-high 10 games under .500 as it was swept at home for the first time in nearly a year.
NATIONALS 5, PHILLIES 1
PHILADELPHIA (AP) — Gio Gonzalez tossed seven sharp innings, the Nationals hit a pair of consecutive homers off Cliff Lee and Washington beat the Philadelphia Phillies.
Anthony Rendon and Wilson Ramos hit back-to-back shots off Lee to start the fifth and Ryan Zimmerman and Jayson Werth did it to open the sixth.
Gonzalez (7-3) gave up one run and six hits, striking out five to win his fourth straight start. The lefty has eight quality starts in a row.
Lee (10-3) had allowed nine homers in his first 135 2-3 innings this year before yielding four in a span of eight batters. Darin Ruf hit a solo shot for the Phillies, who failed to reach .500 for the first time since June 7.
MARLINS 6, BRAVES 2
MIAMI (AP) — Giancarlo Stanton hit a two-run double to end a 10-game RBI drought, and the Miami Marlins broke a five-game losing streak by beating Atlanta 6-2.
Stanton had been in a 3-for-26 slump before he put the Marlins ahead in their four-run first inning against Paul Maholm (9-8). Placido Polanco added three hits and three RBIs.
Jacob Turner (3-1) allowed four hits and two runs in seven innings. Steve Cishek allowed two singles in the ninth to complete a six-hitter.
The Braves won two of three games in the series but missed a chance for their first road sweep since April 12-14 at Washington. Miami improved to 3-12 against the Braves at Marlins Park since it opened in 2012.
REDS 6, BREWERS 2
MILWAUKEE (AP) — Mike Leake scattered four hits over 8 1-3 innings and Brandon Phillips had three RBI, lifting the Cincinnati Reds over the Milwaukee Brewers.
The Reds put the leadoff runner on base in each of the first seven innings and snapped a three-game losing streak.
Leake (8-4) bounced back from a rare rough start in his last outing and seemed to get stronger as the game progressed. He allowed four walks while striking out two.
Milwaukee starter Johnny Hellweg (0-3) had trouble throwing strikes and was battered for his fourth consecutive appearance. The right-hander, who made his major-league debut on June 28, allowed four runs on four hits and five walks in 4 1-3 innings.
Sean Halton hit his first major league home run for the Brewers.
ROCKIES 5, PADRES 4
SAN DIEGO (AP) — Rockies starter Jorge De La Rosa took a one-hit shutout into the sixth inning and Colorado held on to give the left-hander his sixth straight win against the San Diego Padres.
De La Rosa lifted his record at Petco Park to 3-0 with a 1.88 ERA. His winning streak against San Diego spans eight starts.
The Rockies were leading 4-0 in the sixth when Carlos Quentin hit his 11th home run, a two-run shot to straightaway centre field, scoring Chase Headley, who had walked. That was all for De La Rosa (9-5), who allowed two hits over five innings with four walks and four strikeouts.
Andrew Cashner (5-5) went five innings for the Padres, giving up three runs, two earned, on eight hits.
PIRATES 5, ATHLETICS 0
PITTSBURGH (AP) — Francisco Liriano scattered four hits over seven innings, and the Pittsburgh Pirates beat the Oakland Athletics.
Liriano (9-3) struck out six and walked one. He trimmed his ERA to 2.00 as the Pirates snapped a four-game losing streak. Pedro Alvarez went 2 for 4 and drove in two runs for Pittsburgh. Andrew McCutchen, Starling Marte and Jose Tabata also had two hits each as the Pirates beat Oakland for the first time ever.
Pittsburgh came in 0-11 against the A's since interleague play began in 1997 but broke loose against Tommy Milone (8-8). The Pirates worked quickly, following a nearly three-hour rain delay, and touched Milone for three runs in the third inning.
CARDINALS 5, ASTROS 4
ST. LOUIS (AP) — Matt Carpenter hit a two-run home run and Matt Holliday drove in two with a two-out hit to help the St. Louis Cardinals beat the Houston Astros.
Carpenter's ninth homer of the season in the seventh gave the win to Seth Maness (5-1). Tony Cruz got hit by starter Jordan Lyles' first pitch of the inning and one out later Carpenter put a 2-1 pitch into the right field stands off reliever Wesley Wright (0-3).
Maness gave up two hits and a run in two innings of relief. He struck out three.
Edward Mujica earned his 25th save in 26 tries. He has appeared in six consecutive games, going 1-1 with four saves.
ANGELS 13, CUBS 2
CHICAGO (AP) — Josh Hamilton hit two home runs, Albert Pujols also connected and the Los Angeles went deep a season-high five times in a rout of the Chicago Cubs.
Mark Trumbo and Brendan Harris also homered for the Angels. Hamilton drove in five runs and Pujols drove in three.
All of the Angels' home runs were no-doubters. They hit a pair during a five-run first inning and then followed with three more in a six-run fifth, providing more than enough support for C.J. Wilson (9-6).
The Angels have won 11 of 14. Once 12 games under .500, they are now within two games of the break-even mark — since June 12, they have the best record in baseball at 17-8.
Jeff Samardzija (5-9) took the loss for the Cubs, who had their four-game winning streak snapped, a day after they hit five home runs to beat the Angels 7-2.