Updated

Adam Eaton drove in the winning run in the 18th inning as the Arizona Diamondbacks took a 12-7 win over the Philadelphia Phillies in a seven-hour contest from Citizens Bank Park.

After nine innings of no runs, the Phillies turned to Casper Wells (0-1) to come in from right field to pitch. He got the first two batters out, but then walked Tony Campana. On a hit-and-run play, Eaton punched a hit to center and Campana raced home for the go-ahead run.

"(Wells) actually came out with some good stuff, getting the first two hitters. It looked like he was going to give us another chance to put a zero up," Phillies interim manager Ryne Sandberg said.

Martin Prado later singled home another run and Gerardo Parra chased in two more with another base hit. John McDonald became the second position player to pitch in the game for the Phils, and he gave up an RBI single to pitcher Trevor Cahill before finally getting the third out of the inning.

Cahill (5-10) finished off four scoreless relief innings in the home half of the 18th inning to pick up the win and end the game after seven hours and six minutes.

Prado hit a two-run home run and drove in three, while Parra went 5-for-9 with three RBI for the Diamondbacks, who had lost four of five coming into the game.

Darin Ruf tied the game with a two-run home run in the eighth, while Carlos Ruiz drove in two runs for the Phillies, who had won five of six coming into the game, including three straight walk-off wins.

Neither starter factored into the decision as Ethan Martin didn't even get out of the first inning for Philly after giving up three runs on three hits, while Randall Delgado was charged with three runs on three hits over six frames for Arizona.

In some good news for the Phillies, Sandberg said after the game that Roy Halladay will be back on the mound for the first time since having surgery on his right shoulder back on May 16.

The Diamondbacks jumped on Martin in the first as Paul Goldschmidt walked with two outs and Prado followed with a homer to left. Aaron Hill then walked and Parra singled before Wil Nieves punched a single to center for a 3-0 lead.

After Cliff Pennington walked, Martin was relieved by Luis Garcia, who got Delgado to ground out and end the inning.

Eaton tripled with one out in the second and came home on a Goldschmidt groundout for a 4-0 lead.

Pennington hit into a double play with the bases loaded in the third for another run, and Parra's RBI single in the fifth gave Arizona a 6-0 lead.

The Phils were held hitless through the first four innings, but Ruiz broke that in the fifth as he led off the frame with his fourth homer of the year.

Arizona got the run back in the sixth on a RBI single from Eaton, but the Phils made it a 7-3 game in the home half with a solo home run from Roger Bernadina and a wild pitch from Delgado that allowed Jimmy Rollins to come home.

Philly tied the game in the eighth as Chase Utley hit a sacrifice fly and Ruiz singled in another run before Ruf launched his 11th homer of the season.

The Phils left the bases loaded in the ninth to send the game to extra innings, while the D-backs wasted a first-and-third opportunity in the 10th as Prado hit into a double play to end the frame.

Arizona loaded the bases in the 12th, but Prado fouled out to end the inning and pitcher Tyler Cloyd grounded out to third in the 13th to leave the bags full for the Phils.

"The (pitchers) in extra innings just stepped up huge, putting up zeros over, over and over again," Pennington said.

Game Notes

It was the longest game-time in Phillies history ... Wells last pitched on June 28 of this year for the White Sox against the Indians ... It was the first time in team history the Phillies used two position players as pitchers ... This was the longest amount of time a game went since the Dodgers and Astros played 7 hours, 14 minutes on June 3, 1989 ... There were 44 players who made an appearance in this game ... Hill left the game in the 11th inning with an injured groin ... The teams left a total of 41 men on base as the Phillies went 2-for-15 with runners in scoring position and Arizona finished the game 7-for-24.