Updated

PHOENIX -- Robbie Ray has had trouble going deep into games this season.

Not much changed Wednesday night as Ray couldn't get out of the fifth inning in the Arizona Diamondbacks' 4-3 loss to the San Diego Padres.

Ray, who had limited the Padres to a single run in his first four innings, gave up a two-out, three-run homer to Matt Kemp in the fifth. The blast gave the Padres a 4-2 lead and chased Ray from the game.

Trailing 2-1 in the fifth inning, Wil Myers walked and then Yangervis Solarte singled. Kemp followed with a line drive to right that barely cleared the fence.

"Really it was just one pitch that got me," said Ray (4-12). "I went back and looked at it. It is not really a bad pitch. It was off the plate but a little up."

Diamondbacks manager Chip Hale said, "I left him in because it was his game to win. At some point in their careers, they are going to have to take the bull by the horn in the fifth inning, to get out of that inning and get a win. That is his game to win right there. "

Kemp hit a fastball on a 2-2 count. He knew he'd hit the ball well, but wasn't sure he'd knocked it out.

"The ball travels well here," Kemp said. "Good thing we were playing here."

Kemp has 22 homers and 97 RBIs, the most by a Padres' outfielder since Greg Vaughn had 119 in 1998.

Andrew Cashner (6-15) set aside nearly five months of struggles Wednesday night. The result was an effective seven innings in which he allowed seven hits and three runs, striking out six and walking two. He had lost 13 of his previous 17 decisions since April 24.

"Cashner was great; player of the game for me," manager Pat Murphy said. "He just attacked a very good offensive team.with 75 percent (of his pitches) or more were fastballs. Hopefully, he learned something he can take with him going forward, that he doesn't need to go deep in counts. His fastball is that good."

Jarrod Saltalamacchia hit a solo homer off Cashner in the sixth to cut the Padres' lead to 4-3.

Craig Kimbrell got the final four outs for his 37th save. He also got his first career at-bat in the eighth, striking out.

Kimbrell, who hadn't pitched in a week, had joked earlier in the day that he might get an extended stint on the mound and that he might actually step in the batter's box.

Then, "It actually happened," Kimbrell said. "It was fun."

Murphy said he let Kimbrell hit because he was reluctant to do a double-switch and remove any of his starters, for both offensive and defensive reasons. A.J. Pollock had three hits, including a double. David Peralta extended his hitting streak to 13 with a fourth-inning double to right.

The Diamondbacks loaded the bases in the fourth on Peralta's double and Cashner's walks to Jake Lamb and Brandon Drury. Then Chris Owings lined a two-run single to right to give Arizona a 2-1 lead.

The Padres took a 1-0 lead when Cory Spangenberg singled home Brett Wallace, who had doubled, in the fourth.

UP NEXT

Padres: RHP Ian Kennedy (8-14, 4.28 ERA) is set to start Friday night at Colorado. He lost his last start, an 8-0 Padres' loss Saturday at San Francisco.

Diamondbacks: LHP Rubby De La Rosa (12-8, 4.75) will make his 30th start of the season Friday night at San Francisco. He has a 2.20 ERA in three career outings at the Giants.