ST. PETERSBURG, Fla. -- Wil Myers tied it with a two-run single on a jarring play in the seventh inning then pinch-hitter James Loney stunned the Orioles with a leadoff homer in the ninth, and the Tampa Bay Rays completed a four-game sweep that put a serious damper in Baltimore's wild-card hopes with a 5-4 victory Monday.
The Orioles also lost All-Star third baseman Manny Machado to a leg injury in the top of the seventh. Machado's left leg buckled when he stepped on first base running out an infield single. He was taken off on a stretcher.
The win pushed the Rays a full game ahead of idle Cleveland for the top AL wild card. Baltimore fell five games back of the Indians with six games to go for both teams.
With the bases loaded, two outs and trailing 4-2 in the seventh, Myers, a rookie, 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.
Casilla was shaken up on the play, but remained in the game. However, he left one inning later.
Hitting for Sean Rodriguez, Loney lined an 0-1 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.
Chris Davis hit his major league-best 52nd homer for Baltimore.
After Matt Wieters was thrown out attempting to stretch a leadoff double into a triple in the eighth, Nate McLouth turned a bunt to the first base side off reliever Jamey Wright into a double. Wright worked out of the jam by retiring the next two batters.
Machado singled for the Orioles' first hit leading off the fourth and Davis followed with his two-run shot off Chris Archer as part of a three-run inning that put Baltimore ahead 3-1. J.J. Hardy had an RBI single.
Going back to the final 11 innings of the Orioles' 5-4, 18-inning loss to the Rays Friday night, Baltimore had just two runs and 10 hits over 32 innings before getting the three runs on four hits in the fourth.
The fourth inning ended when Ryan Flaherty was retired on a strange strikeout with two on. He swung and missed a two-strike pitch that ended up hitting him in the leg.
Jose Molina got the Rays to 3-2 on an RBI double in the bottom of the fourth.
Brian Roberts gave Baltimore a 4-2 lead on a fifth-inning homer.
Tim Beckham, taken first overall in the 2008 draft, put the Rays up 1-0 on a sacrifice fly in the second. It was the rookie's first major league RBI.
Archer gave up four runs and five hits in 4 1-3 innings. Baltimore left-hander Wei-Yin Chen also went 4 1-3 innings, allowing two runs and six hits.
NOTES: The Rays had been hitless in their previous 18 at-bats with the bases loaded before Myers' hit in the seventh. ... Tampa Bay slugger Evan Longoria, who was out of the starting lineup Sunday due to flu-like symptoms, started at third. ... Orioles manager Buck Showalter said RHP Chris Tillman, who tweaked his ankle last Thursday, will make his scheduled start Tuesday night against Toronto. ... Tampa Bay CF Desmond Jennings sat out went with a left hamstring strain. Rays manager Joe Maddon expects Jennings to return before the regular season ends.