San Diego avoided a three-game sweep at the hands of the Diamondbacks, who fell 5 1/2 games out of National League wild card contention.
RBI doubles in the sixth inning by Chris Denorfia and Chase Headley gave San Diego a 6-2 cushion and handed the victory to Clayton Richard (14-12).
Richard allowed four runs on eight hits in six innings to win his fifth straight decision. He has a 6-0 career record against Arizona.
Anthony Bass came on with the bases loaded and two out in the ninth to strike out Tom Layne and record the first save of his major league career. The save came in what was the 48th appearance for Bass over two years.
Tyler Skaggs (1-3) took the loss, surrendering four runs on seven hits in five innings.
Exploding whale video goes viral on Internet
Campus cop fatally shoots Texas student during traffic stop