With considerable help from the Rays, the Red Sox pulled off a baseball trifecta.

The defending World Series champions fell behind, lost their composure and then lost the game in a dizzying span Sunday afternoon as the suddenly surging Rays emerged with an 8-5 victory before a vocal Tropicana Field crowd of 26,199 that almost witnessed a seventh-inning brawl.

By completing a three-game sweep and handing the Red Sox their 10th consecutive loss, the Rays remained six games behind the first-place Blue Jays heading into tonight’s opener of a three-game series at Toronto.

Sean Rodriguez triggered a five-run seventh by hitting a pinch-hit three-run home run that snapped a 3-3 tie. The blast to left field came only minutes after former Ray Jonny Gomes cracked a two-run homer as a pinch-hitter against Joel Peralta, who was credited with the win while setting a franchise record with his 251st career appearance.

Yunel Escobar’s two-run double extended Tampa Bay’s lead to 8-3 and the Red Sox began chirping at Escobar from the dugout after he advanced to third base on defensive indifference.

Both dugouts emptied and Gomes appeared to push Escobar from behind while racing in from left field.

The Red Sox may have been understandably ornery given their startling two-week tailspin, but Rays manager Joe Maddon was hardly in a conciliatory mood after the game.

“We’ve gone through some tough times ourselves,’’ Maddon said. “And I don’t expect pity from anyone. I don’t expect concessions. It’s up to us to turn this around ourselves.’’

Jake Odorizzi matched his career high with six solid innings, yielding four hits and one run while striking out five. After a two-run single by Xander Bogaerts against Josh Lueke in the ninth, Grant Balfour nailed down the final out for his ninth save.

“A lot of strikes today,’’ said Odorizzi, who threw only 34 balls among his 108 pitches. “One walk was not bad and that was the biggest thing ... finding that consistency that I was looking for.’’

While the Rays take a four-game winning streak into the Rogers Centre, the Red Sox are dealing with their longest losing streak in two decades as they head into Atlanta. Boston and Tampa Bay meet again next weekend at Fenway Park — where there’s a chance tempers will flare again.

“We’re down five in the seventh, so it’s somewhat of a gray area when you shut down the running game,’’ Boston manager John Farrell said. “Yunel is going to do some things that might be a little unpredictable, so that’s what precipitated it.’’