NEW YORK _ As much as the Yankees are chasing the American League East-leading Red Sox, they're also trying to fend off the Rays.
Tampa Bay wasn't considered much of a threat in the division coming into the season, but the Rays entered Thursday four games above .500 and 1 { games behind the Yankees in third place.
So this four-game series at Yankee Stadium is a significant one.
Brett Gardner made sure the Yankees took the first game.
Gardner blasted a solo homer in the bottom of the 11th inning to send the Yankees to a 6-5 win over the Rays in front of 44,033 at the Stadium.
Aroldis Chapman pitched perfect innings in the 10th and 11th to preserve the tie.
Yankees manager Joe Girardi wasn't around to see the end of the game after he was ejected in the seventh for arguing balls and strikes.
The Yankees made it a one-run game in the eighth as pinch-hitter Matt Holliday hit into an RBI fielder's choice against reliever Brad Boxberger, who then allowed a single to Todd Frazier before getting Tyler Wade to ground into an inning-ending double play.
The Yanks tied it in the bottom of the ninth.
Brett Gardner led off with a triple to the left-center field gap against reliever Alex Colome.
Clint Frazier then grounded out for the first out of the inning, which brought up Aaron Judge, who flied out to right for the second out.
So the Rays were one out away from ending it, but a defensive lapse cost them the lead.
Gary Sanchez then hit a grounder that went right between second baseman Tim Beckham and shortstop Adeiny Hechavarria, who were both playing on the left side of second, and into center field.
That allowed Gardner to score the tying run, sending the game to extra innings.
It also let Girardi off the hook after he pulled CC Sabathia with one out in the fifth and runners on first and second and put in Chad Green, who promptly gave up a two-run double to pinch-hitter Brad Miller.
But Gardner's homer erased any second-guessing.
The Yankees, meanwhile, jumped on Rays starter Chris Archer early.
Chase Headley singled with one out and Jacoby Ellsbury, who entered the game having gone 20-for-40 against Archer in his career, hit an RBI double to put the Yankees up, 1-0.
Todd Frazier followed that up with an RBI single.
Sanchez's solo homer with one out in the third gave the Yankees a 3-0 lead.
Sabathia gave one run back in the fourth when he surrendered a lead-off homer to Evan Longoria, but the left-hander then ran into more trouble in the fifth.
He began the inning by striking out Tim Beckham, giving Sabathia the 2,800th strikeout of his career to pass Cy Young for 20th place on the all-time list.
But Sabathia then gave up back-to-back doubles to Hechavarria and Peter Bourjos to slice the Yankees' lead to 3-2.
Sabathia then walked Steven Souza Jr., and that ended up being the last batter he'd face as Girardi went to the bullpen and brought in Green.
Sabathia gave up five hits with a walk and three strikeouts.
But Girardi's move backfired.
Green gave up a two-run double to pinch-hitter Brad Miller, putting the Rays up, 4-3. The right-hander retired the next two batters he faced to get out of the inning and avoid further damage.
He couldn't do the same in the sixth, giving up a one-out homer to Corey Dickerson that made it a two-run game.
The Yankees wasted a prime scoring opportunity in the sixth.
With one out, Didi Gregorius and Headley hit back-to-back singles while Ellsbury walked to load the bases.
But the Yankees couldn't capitalize as Archer struck out Frazier and Wade to escape the jam. That was the final inning for Archer, who gave up eight hits and struck out 10.