NEW YORK (AP) -- Even at the end of an exhausting series, the Arizona Diamondbacks are a determined bunch in extra innings.
Cliff Pennington hit an RBI single with two outs in the 15th and the Diamondbacks, boosted early by Gerardo Parra's bunt double, finally outlasted the New York Mets 5-4 in a back-and-forth classic Thursday to split a draining four-game set at Citi Field.
Arizona scored in the final three innings but couldn't close out the feisty Mets until Brad Ziegler retired Kirk Nieuwenhuis on an easy grounder with runners at second and third to finish a game that lasted 5 hours, 46 minutes.
''It's a grind, but if we want to win a world championship, we're going to have to endure a lot worse than that,'' Diamondbacks manager Kirk Gibson said.
Anthony Recker and Nieuwenhuis hit tying homers in consecutive extra innings for New York, making its final home appearance before hosting the All-Star game July 16.
Meanwhile, the NL West-leading Diamondbacks improved to 10-3 in extra innings, the most such wins in the majors.
''There's no question this team will fight to the end of the game,'' Ziegler said. ''It's just two really competitive teams going out and putting on a show on a holiday.''
In a span of four days, the clubs played a 13-inning game, a 15-inning marathon and two others delayed by rain for a total of 3 1/2 hours. The 16 hours, 40 minutes worth of baseball marked the second-longest four-game series in the majors since 1987, according to STATS. The Dodgers and Astros played 11 more minutes inside the Houston Astrodome back in 1989.
So it was only fitting that the finale Thursday went on and on throughout a humid afternoon as kids who lined up beyond the outfield wall in the eighth inning waited patiently to run the bases after the final out.
''It felt like a marathon tennis match, to be honest with you,'' Nieuwenhuis said. ''It's tough not to come up on top there at the end, but it's a 162-game season and we've got to bring it tomorrow.''
Cody Ross drew a bases-loaded walk from New York reliever David Aardsma in the 13th, but the Diamondbacks squandered a great chance to add on. And of course, with two outs in the bottom half, Recker homered off Heath Bell to tie it again.
Arizona pushed across another run in the 14th on Martin Prado's bloop RBI single off Brandon Lyon with two outs.
Moments later, Nieuwenhuis sent a one-out liner barely over the left-center fence off Chaz Roe (1-0), who made his major league debut in the series opener Monday.
Recker and Nieuwenhuis were both batting .167 when they connected. The Mets said the last time a team hit two tying homers in extra innings was 1998, when Ray Lankford and Eli Marrero did it for the Cardinals.
''At first, you get disappointed. You've got the lead, they hit the home run. And it's disappointing when you have to reload and understand what's ahead of you,'' Gibson said. ''Then, they hit the second one and you've just got to tell yourself, 'You can take it.' You learn a lot about yourself in series like this and days like this.''
Scott Rice (3-5) retired his first two batters in the 15th before Parra singled. Wil Nieves followed with a single for his fourth hit and Pennington lined a single to left to make it 5-4.
Pennington is 8 for 11 with three RBIs in extra innings this season.
Ziegler walked two in the bottom half but hung on for his first save since 2011 with Oakland.
And at last, it was over.
''This is one of the good signs for this club: We're really good in close games,'' Gibson said. ''A good character check today. They all stepped up.''
The Mets are no strangers to long games themselves- especially on July 4. They lost a 20-inning marathon at home to Miami last month, won a 20-inning game in St. Louis three years ago and came out on top in an Independence Day thriller at Atlanta in 1985.
That rain-delayed 16-13 victory is best remembered for Braves pitcher Rick Camp's tying homer with two outs in the 18th and the postgame fireworks that went off around 4 a.m.
By pulling out this test of endurance, the Diamondbacks finished 3-7 on a long road trip against three NL East teams.
''It was exhausting, especially when we got the lead twice and we kept losing it,'' said Nieves, who had a teddy bear in his bag to bring home to his daughter.
Wearing alternate caps on the Fourth of July, the teams were back at it in 87-degree heat and humidity less than 13 hours after their rain-delayed game ended Wednesday night. Arizona put the leadoff batter on six times in the first eight innings but managed only Nieves' two-run single in the fifth.
Mets starter Dillon Gee and counterpart Ian Kennedy, who matched a season high with eight strikeouts, kept the sluggish offenses in check for seven innings each.
Gee, who entered with a .126 career batting average, lashed a two-out RBI single that tied it at 2 in the fifth.
Ross drew a leadoff walk in the fifth and Parra dragged a hard bunt through the right side. With second baseman Daniel Murphy cheating toward the middle and first baseman Josh Satin breaking back to the bag, the ball rolled into shallow right field before Murphy could retrieve it.
Ross scampered to third and Parra slid into second easily. Nieves smacked the next pitch for a two-run single.
David Wright doubled in the Mets fourth and advanced on Kennedy's wild pitch before scoring on a groundout by Marlon Byrd.
NOTES: For the first time since 1973, the Mets have played three games that lasted at least 15 innings. They've lost all of them. ... Arizona will recall top prospect Tyler Skaggs from Triple-A Reno to start Friday night against Colorado in place of injured RHP Trevor Cahill (bruised right hip). The 21-year-old lefty went 1-1 with a 5.40 ERA in three starts for the Diamondbacks earlier this season. He was optioned to Reno on June 10. ''He went back down there and got some more starts. He'll have a better understanding of what he's up against,'' Gibson said. ... Parra returned to the lineup in RF after sitting out two games. He was shaken up trying to make a diving catch on the warning track Monday, leaving him with scrapes and bruises on his face and arm. ... After the game, the Mets designated Lyon for assignment. They will recall reliever Greg Burke from Triple-A Las Vegas before Friday night's game in Milwaukee. ... Mets RHP Zack Wheeler (1-1, 5.06 ERA) makes his fourth major league start Friday night. ... New York pinch hitter John Buck was ejected in the 12th by first base umpire Mike Everitt for protesting a checked-swing third strike.