The Rays stayed at the top of the American League's wild card race while ensuring the Yankees will miss the playoffs for only the second time in 19 years.
New York last sat out the postseason in 2008, when the Yankees finished third in the American League East and won 89 games. They have 82 wins with four games remaining this year in what has been an injury-plagued campaign. The Yankees have lost three in a row and eight out of 11.
Tampa Bay, meanwhile, has run off six straight victories to take command in what has become a race for the two wild card berths that also involves Cleveland and Texas.
The Rays owned a 3-2 lead heading into the sixth, during which they scored four runs on four hits off reliever David Huff.
Tampa Bay put runners on first and second with two away before Longoria hit his 30th home run of the season. David DeJesus followed with another blast to give Tampa Bay a five-run cushion and all but seal the Yankees' playoff fate.
David Price (9-8) went seven innings to get the win, allowing two runs on six hits with eight strikeouts. The setback was suffered by Phil Hughes (4-14), who was touched for three runs on seven hits in just two innings.
Attkisson leaves CBS News, reportedly over network's 'liberal bias'
McPhee, Cokas 'working on their marriage' after affair