NEW YORK -- Wilson Ramos highlighted a seven-run top of the fifth inning Thursday with a go-ahead two-run homer, lifting the Tampa Bay Rays to a 9-6 victory over the New York Yankees, who are on the verge of elimination from the American League East title race.
Aaron Judge hit his league-leading 51st homer as New York took a three-run lead while the Houston Astros were building a lead on the Boston Red Sox, but Ramos' homer helped reduce Boston's magic number for clinching to one.
Despite the Red Sox's loss, Boston (92-67) remains three games ahead of the Yankees (89-70) with three games left for each team.
Two nights after being robbed of a grand slam in front of the 385-foot sign by Aaron Hicks, Ramos slugged Sonny Gray's first pitch to straightaway center field and watched Jacoby Ellsbury climb the wall before the ball cleared the fence.
Cesar Puello added to the inning with an RBI single, and Peter Bourjos capped the rally with a two-run triple.
Dickerson hit a solo homer in the first inning, and Trevor Plouffe hit his first career pinch-hit homer in the sixth for Tampa Bay.
Brett Gardner and Judge opened the game with homers, marking the first time in more than five years that New York began a game with two homers. Greg Bird also Hicks went deep for the Yankees, who lost for the eighth time in 27 games.
After Tampa Bay's Jake Faria allowed three runs on four hits in three innings, Chih Wei-Hu (1-1) was credited with his first major league win. Hu yielded Bird's solo homer in his lone inning.
Gray (10-12) allowed six runs and six hits in 4 2/3 innings.
The Rays opened a 1-0 lead on the fourth pitch of the game when Dickerson drove a fastball into the second deck in right field with one out for his 27th homer.
Tampa Bay's lead was short-lived as Gardner hit his fifth leadoff homer of the season into the right field seats and Judge homered into the right field seats.
The Yankees extended the lead to 4-1 on Frazier's single in the second and Bird's homer to right in the fourth but lost it in the fifth because of Sanchez's defensive struggles and Gray's ineffectiveness.
Smith singled and scored on a wild pitch while Sanchez's throwing error allowed Dickerson to reach third. Dickerson then scored on Sanchez's passed ball and Ramos gave the Rays a 5-4 lead by lifting Gray's first pitch over the center field fence.
Tampa Bay pushed the lead to 8-4 on Puello's bloop single and Bourjos' third triple of the season, off Jonathan Holder.
Castro's infield single made it 8-5, but Bird struck out with two on to end the fifth.