Baltimore needed a win over Tampa Bay to have any chance of tying the division-champion New York Yankees in the American League East.
The Orioles will now take on Texas in a one-game wild card playoff Friday beginning at 8:37 p.m. EDT. Texas and Baltimore finished with the same record (93-69), but the Rangers will host the playoff contest by virtue of their 5-2 record against the Orioles this season. The winner of that game will then meet New York in a best-of-five series.
Longoria hit his home runs in the first, fourth and sixth innings to give him 17 for the season and Ryan Roberts added a solo blast in the fourth.
Five Tampa Bay pitchers combined to give up three hits and a lone ninth-inning run. Jeremy Hellickson (10-11) got the win with 5 1/3 innings of work, during which he surrendered one hit and struck out six.
Fernando Rodney came on with a run in, a runner on first and two away in the ninth and recorded the final out for his 48th save. He finished the season ranked second in that department -- three behind Baltimore's Jim Johnson.
Three of the four Toronto home runs came off Chris Tillman (9-3), who went five innings to take the loss.
Tampa Bay finished at 90-72, the best record among the 20 teams in the majors not to make the playoffs.
Beyonce flaunts bikini body, Blue Ivy in vacation pics
Gal Gadot cast as Wonder Woman for 'Batman vs. Superman'