The uprising started after the Phillies turned to outfielder Casper Wells (0-1) to pitch, having already gone through nine pitchers in the game. Wells, who pitched an inning earlier this year while with the Chicago White Sox, got the first two outs in the 18th before Campana walked on five pitches.
Adam Eaton followed with a double to center and Campana, who was running on the pitch, scored without a throw.
Paul Goldschmidt was intentionally walked and Martin Prado added a single that scored Eaton. Didi Gregorius walked to load the bases before a single by Gerardo Parra knocked in two runs and Wells was lifted for infielder John McDonald, who gave up two singles -- one scoring a run -- before recording the final out.
Trevor Cahill (5-10) -- the ninth Arizona pitcher -- finished off four innings of two-hit relief to claim the win.
The game lasted 7 hours, 6 minutes and was the longest in Arizona franchise history. The Diamondbacks also set a team-record with their 14th extra-inning win in a season.
Arizona totaled 22 hits, with Eason going 4-for-10 while Parra and Prado were both was 3-for-9 with three RBI.
Arizona scored five times in the first three innings and added a run in the fifth for a 6-0 advantage. The Phillies scored in a fifth but the Diamondbacks went back up by six runs in the sixth.
Roger Bernadina hit a home run and Randall Delgado scored on a wild pitch in the sixth for Philadelphia but it was a four-run, eighth-inning rally, capped by Darin Ruf's two-run home run, that tied the score 7-7.
The teams went nine scoreless innings before the Diamondbacks broke through in the 18th.
Wisconsin business offering 'therapeutic cuddling' forced to close
Britney Spears debuts 'Perfume' video