ST. PETERSBURG, Florida (AP) -- James Loney hit a leadoff homer in the ninth as the Tampa Bay Rays rallied to complete a four-game sweep of Baltimore with a 5-4 win on Monday, putting a serious damper in the Orioles' wild-card playoff hopes in the American League.

The win pushed the Rays a full game ahead of idle Cleveland for the top AL wild card spot. Baltimore fell five games behind the Indians with six games to go for both teams.

With the bases loaded, two outs and trailing 4-2 in the seventh, Baltimore's Wil Myers sent a flare behind second base. Second baseman Alexi Casilla, who entered the game in the eighth, made a fully extended diving catch but he collided with Nick Markakis, racing in toward the ball from right field. The ball came loose and two runs scored.

Then, in the ninth, Loney lined a pitch from Tommy Hunter (6-5) down the right field line.

Joel Peralta (3-8) pitched a perfect ninth for the Rays, who have won nine of 12.