Wilmer Flores drove in the winning run with a two-out RBI single.
Godley, moved to the bullpen to open a spot in the rotation for rookie Taylor Clarke, struck out two during a perfect ninth for his first career save.
“Felt good just to get on the mound again. … It’s awesome to be able to go out like that when it’s a very positive situation,” Godley said.
Eduardo Escobar made up for a crucial throwing error, leading off the 13th with a single off Adam Kolarek (2-1) — Arizona’s first hit since the fifth inning. He moved to second on a double-play grounder before scoring on Flores’ two-out, broken-bat hit to right field off Chaz Roe.
Bradley (2-3) allowed one hit and struck out five. Godley, the seventh Diamondbacks reliever, finished the four hour, 39-minute marathon in which Arizona pitchers combined to set a franchise record with 23 strikeouts.
“You can’t predict things like that, there’s no way,” Lovullo said. “I was trying to stay from Archie and give him a little chance to catch his breath, but you’re forced into a situation where you can’t do that. Those guys are tough, that’s what it shows me. They wanted to get to the mound, make it happen and they came through in a big way.”
The Rays rallied from a 2-0 deficit to force extra innings, scoring on Escobar’s eighth-inning error and Kevin Kiermaier’s two-out, pinch-hit single in the ninth.
Adam Jones and Ketel Marte drove in runs off Rays starter Charlie Morton for the Diamondbacks, who avoided a sweep after being outscored 18-4 in the first two games against the AL East leaders.
The Rays made it interesting in the eighth, scoring an unearned run on Escobar’s errant throw to trim Arizona’s lead to 2-1. But they failed to take advantage of eventually loading the bases with no outs.
Reliever T.J. McFarland, the third Arizona pitcher of the inning, escaped the jam by striking out Brandon Lowe and getting Willy Adames to line out to second base.
“We’ve got to find a way to score and we just didn’t,” Rays manager Kevin Cash said. “They just made good pitches.”
The Diamondbacks weren’t as fortunate in the ninth, when closer Greg Holland gave up a two-out double to Yandy Díaz and walked Tommy Pham intentionally before Tampa Bay tied it on Kiermaier’s single to right.
The Rays ran themselves out of a potential game-winning rally. Kiermaier was caught in a rundown between first and second base after his hit, and Pham was thrown out at the plate trying to score from the third.
“You feel good about yourself tying the game and doing everything you could to give your team a chance,” Kiermaier said. “But I was maybe a little too aggressive, and that’s why I’m a little upset with myself.”
Jarrod Dyson drew a pair of leadoff walks and scored Arizona’s first two runs on a force play and Marte’s RBI single that made it 2-0 in the third. The Diamondbacks had plenty of other opportunities, but were just 1 for 8 with runners in scoring position against Morton.
Lowe extended his hitting streak to a career-best 12 games with an infield single for Tampa Bay, which was even worse than Arizona with runners in scoring position — going 0 for 12 with eight strikeouts before Kiermaier’s ninth-inning single tied it.
Robbie Ray pitched 5 2/3 scoreless innings for Arizona, and allowing four hits and striking out a season-high 11. The Diamondbacks starter fanned six of the seven batters he faced with runners in scoring position.
Diamondbacks: RHP Taijuan Walker (Tommy John surgery) may start a 30-day minor league assignment soon. He threw 47 pitches at extended spring training on Monday.
Rays: C Michael Perez was placed on the 10-day injured list after with a right oblique strain that occurred during batting practice Tuesday. C Mike Zunino (left quad) was removed from the game in the eighth inning.
Attendance for the three-game series was just 24,846. Wednesday’s finale drew the largest crowd, 8,663.
In all, there 42 strikeouts. Rays pitchers fanned 19, including John Ryan Murphy four times. Lowe struck out five times, a Tampa Bay franchise record.
Diamondbacks: Return home from a six-game trip to begin a four-game set with Atlanta, with RHP Luke Weaver (3-1, 3.29 ERA) facing Braves RHP Mike Soroka (3-1, 1.14) on Thursday.
Rays: Off Thursday before hosting a weekend series against the second-place New York Yankees. RHP Tyler Glasnow (6-0, 1.47) is scheduled to start Friday against the Yankees’ Domingo German (6-1, 2.35).
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP_Sports