PHOENIX — Batting for the eighth time in the game — and facing a catcher he later called the best position player he's ever seen pitch — Wil Myers got something he liked and hammered it.
Myers homered for the fourth time in two days, connecting in the 16th inning off Arizona Diamondbacks backstop Jeff Mathis to send the San Diego Padres to a 4-3 victory Sunday.
Myers, who hit three home runs Saturday, clubbed a 3-2 pitch from Mathis (0-1) over the right-field fence with two outs. Mathis was making his first pitching appearance since 2012 and the third of his career. He moved to the mound after catching 15 innings.
"After the first couple of pitches I was like, I have to lock it in right here because this guy is actually pitching," Myers said. "What is funny about baseball is my first five at-bats I was 0 for 5 and felt as good as I did (Saturday)."
Mathis threw fastballs and changeups. When the Diamondbacks ran out of relievers and available starters, he was chosen because of his familiarity with the distance between the pitching rubber and home plate.
"I'd have liked to get the third out right there," Mathis said. "Just didn't get the ball down. Honestly, I was just worried about trying to get it over the plate."
The game was the longest of the season for Arizona in terms of innings, and tied for the second-longest in club history.
The Diamondbacks used two starting pitchers out of necessity. Zack Greinke began the game and Zack Godley entered in extra innings.
Manuel Margot had a career-high five hits for the Padres and added a stolen base. All-Star closer Brad Hand (2-4) worked two innings for the win in a game that lasted 5 hours, 31 minutes.
Hand overcame a leadoff double in the 16th. The Padres won despite striking out 20 times and leaving 15 runners on base.
"It is a war of attrition out there, and we had a little bit more arm out there than they did," manager Andy Green said.
In his 400th career start — only three other active pitchers have reached that milestone — Greinke lasted just 4 1/3 innings, the shortest outing of the season for the Diamondbacks ace.
Greinke allowed two runs on six hits with three walks and five strikeouts. But he did contribute on offense.
After failing to execute a third-inning sacrifice that turned into a fielder's choice, he went to second on a hit-by-pitch and stole third base, taking over the major league lead for steals by a pitcher with his third of the season.
Greinke's three stolen bases is a season record for a Diamondbacks pitcher.
Austin Hedges singled in the fourth to tie the game at 2 after Greinke got the first two outs.
The Diamondbacks regained the lead in the bottom of the fourth when Mathis doubled in Ketel Marte with one out.
Padres starter Clayton Richard struggled through five innings, allowing three runs and five hits. He walked four, twice hit Jon Jay with a pitch, and also threw a wild pitch.
Richard escaped jams in the third and fourth with defensive help. Margot dove to take a potential run-scoring hit away from Steven Souza Jr. in the third, and the Padres turned a double play with the bases loaded to end the fourth.
Arizona's A.J. Pollock was ejected for the second time in his career in the fifth after arguing a called third strike.
The Padres tied it at 3 on pinch-hitter Jose Pirela's two-out single in the sixth to drive in Margot.
"It's a long way to go to not win a game," Diamondbacks manager Torey Lovullo said. "Our guys grinded and fought, did everything they possibly could. When you ask your bullpen to throw 10-plus innings as effectively as they did, you think you're going to win the game. Unfortunately, we didn't."
Diamondbacks first baseman Paul Goldschmidt and starting pitcher Patrick Corbin made the NL All-Star team. Goldschmidt was chosen for the sixth consecutive year and set a club record for most selections.
"The two that are going to represent us are excited and ready to go and do what they can," Lovullo said. "Paul came off the mat after a tough May and I thought that was a nice honor."
Hand was San Diego's lone representative.
The Padres recalled right-hander Miguel Diaz from Double-A San Antonio and sent pitcher Kazuhisa Makita to Triple-A El Paso.
Diaz pitched a scoreless 11th inning, recording four strikeouts to become the second Padres pitcher in club history to do so. He threw a wild pitch on one that allowed Chris Owings to reach base.
Also, outfielder Matt Szczur cleared waivers and was outrighted to El Paso.
Diamondbacks: RHP Clay Buchholz (oblique strain) is scheduled for a bullpen session Tuesday.
Padres: Return home to start a four-game series with the Los Angeles Dodgers. RHP Luis Perdomo (1-2) pitches Monday's opener.
Diamondbacks: After a day off, Arizona opens a three-game series Tuesday at Colorado with Corbin (6-3) scheduled to pitch the opener.