Stults was sharp early before giving up a couple of runs that allowed Arizona to tie the game at 3-all.
Medica had a run-scoring single in San Diego's three-run third inning and lined a solo homer to left off Evan Marshall (2-1) in the eighth to put the Padres back up.
Stults had a rough go of it his last outing, failing to get out of the fourth inning after giving up five runs and six hits in a loss to the Chicago Cubs.
The left-hander had the Diamondbacks guessing through the early innings Tuesday night, keeping them off-balance with a big-breaking curveball that dipped into the 60s with an upper 80s fastball.
Prado, who has battled knee problems this season, got a pitch he liked in the second inning, sending a towering solo homer over the wall left, his first in 210 at-bats, dating to last season.
Miguel Montero hit a run-scoring double in the sixth inning and Stults was lifted after Cliff Pennington led off the seventh with a double on a ball right fielder Chris Denorfia appeared to lose in the lights.
Stults allowed three runs and six hits and walked four - one intentional.
Miley had a solid outing his last time out, allowing three runs in seven innings in a loss to the St. Louis Cardinals on Thursday.
The left-hander spotted his fastball well and had the Padres swinging and missing - except in the third inning.
Miley was good after that, ringing up three more strikeouts on called third strikes to become the first Arizona left-hander with at least 11 strikeouts since Randy Johnson on Aug. 22, 2008, against Florida. Miley allowed three runs and eight hits.
NOTES: Diamondbacks LF Mark Trumbo is expected to hit in the batting cage on Wednesday, a first since he went on the DL with a stress fracture in his left foot on April 24. ...Padres C Yasmani Grandal left the game in the seventh inning after being hit on the back of his glove hand by Paul Goldschmidt's bat. He was called for catcher's interference on the play. ... Arizona RHP Chase Anderson will start in the series finale on Wednesday after his previous outing was cut short to three innings due to rain. RHP Tim Stauffer will pitch for the Padres after making his first start in the majors since 2012 last Friday.