But they tied it up in the bottom of the ninth inning and got a home run from Austin Meadows leading off the 11th to rally for an 8-7 victory that prevented the New York Yankees from clinching the AL East title Wednesday night.
"We had a ton of fight," Rays left fielder Tommy Pham said. "Everyone saw it."
Tampa Bay remained two games behind Oakland for the top wild card and a half-game ahead of Cleveland for the second spot.
"They don't get frustrated in the moment, they understand the task at hand, and they rose up to it and had some big, big at-bats," Rays manager Kevin Cash said of his team.
Meadows slugged his 32nd homer off Josh Sborz (0-1), and Ji-Man Choi's sacrifice fly tacked on an insurance run after the Rays had rallied for two runs off Los Angeles closer Kenley Jansen in the ninth.
"Didn't have it today," said Jansen, who has four blown saves in his last eight chances. "Just got to move on. Can't let this one hold you back."
Pham had a career-high five hits for the Rays, who ended a two-game skid.
"Anytime you get five hits you need some luck, and I had some luck," Pham said.
Tampa Bay took advantage of another collapse by Jansen, who had shown improvement lately. He got booed off the field after giving up Choi's RBI single and Travis d'Arnaud's sacrifice fly that tied it 6-all.
The teams combined to use 18 pitchers, two more than on Tuesday.
"Hopefully we never have to play them again in September," Dodgers slugger Cody Bellinger said. "Just no flow to the game."
The Dodgers closed to 8-7 in the 11th on Edwin Rios' RBI single with two outs off Pete Fairbanks. But with runners on first and second, pinch-hitter Russell Martin struck out swinging.
Colin Poche (5-5) got the win. Fairbanks earned his second save.
"That's a big win for us," Fairbanks said. "I don't think there's any quit in the offense."
Bellinger slugged his 45th homer -- and first since Sept. 2 -- in the eighth, ending the Dodgers' three-game skid without a home run. It hit the right field foul pole and extended the lead to 6-4.
"We've still got to fight for home-field (advantage)," Bellinger said. "That's on our mind."
The Dodgers led 5-4 in the sixth after pinch-hitter Joc Pederson singled in the tying run and Chris Taylor scored the go-ahead run on a passed ball by d'Arnaud that scooted off to his left.
Dustin May, the Dodgers' seventh pitcher, put the potential tying and go-ahead runs on in the seventh with consecutive hits by Pham and Nate Lowe. But then May struck out Choi and d'Arnaud, and retired Joey Wendle to end the threat.
In the eighth, May again allowed the potential tying run aboard on a leadoff single to Avisail Garcia, who was thrown out by catcher Will Smith trying to steal second.
The Dodgers led 2-1 on Max Muncy's two-run double in the second.
The Rays tied it 3-all in the fifth on Pham's two-run double and took a 4-3 lead in the sixth on pinch-hitter Jesus Aguilar's RBI single, with Willy Adames scoring on Bellinger's throwing error in center field.
For the second straight game, the Dodgers made a late change to their starting pitcher. RHP Casey Sadler got the nod instead of RHP Tony Gonsolin. Sadler tossed two-thirds of an inning. Gonsolin worked in relief, which is what he'll do in the postseason if he makes the roster, so the team wants to use him in that role down the stretch. The same thing happened Tuesday when Caleb Ferguson replaced scheduled starter Ross Stripling, who pitched in relief, also his likely postseason role.
Dodgers: LHP Rich Hill (left knee strain) will throw to hitters Friday and start Tuesday at San Diego. ... 3B Justin Turner is recovering from a sprained left ankle, but no return date has been set. "When he does come back, I want to be confident he can sustain it," manager Dave Roberts said.
Rays: After an off day, RHP Charlie Morton (15-6, 3.16 ERA) goes for his career-high 16th victory Friday against Boston.
Dodgers: LHP Clayton Kershaw (14-5, 3.05) pitches Friday at home against Colorado. He is 22-8 with a 3.41 ERA in 41 career starts versus the Rockies.
More AP MLB: https://apnews.com/MLB and https://twitter.com/AP-Sports
Bellinger smashes 45th homer of the season
Cody Bellinger gives the Dodgers a 6-4 lead over the Rays with a solo home run to right.