The teams with baseball’s top two records flip-flopped positions in the standings for the third straight night. The first two games of the important series went extra innings, with the Rays winning 1-0 on Monday and the Yankees regaining the division lead by a half-game with an 8-7 win on Tuesday.

The finale was filled with plenty of drama, too, even though the teams are far from finished. They’ll play four more games in New York next week, with Tampa Bay holding an 8-6 edge in the season series.

“This is about as close to a playoff atmosphere as you can get without actually being in the playoffs,” said Johnson, who also drove in the winning runs in two victories over Boston last month, including a 10th-inning walk-off homer on Aug. 28.

Two years ago, he hit a game-tying, ninth-inning pinch-hit homer off Jonathan Papelbon at Fenway Park just hours after being called up from the minors.

Four RBIs tied a career-best for the former Oakland prospect, and nine of his last 10 RBIs have come with the score tied or the Rays trailing by one.

“It’s something about the calm feeling that comes over me in those situations,” Johnson said. “Once you’ve done it a couple of times, you feel like you’re going to do it every time. I think that really helps you in those situations. If you feel like you’re going to do it, you’re probably going to do it.”

Both of the homers came off Phil Hughes (16-8), who retired two of Tampa Bay’s most dangerous hitters — Carl Crawford and Evan Longoria — before giving up a two-out single to Matt Joyce and Johnson’s winning homer in the seventh.

The Yankees had taken a 3-2 in the top of the seventh on Curtis Granderson’s two-run homer off Chad Qualls (1-0).

Randy Choate and Grant Balfour worked a scoreless eighth for the Rays. Rafael Soriano pitched the ninth, earning his franchise record-tying 43rd save in 46 opportunities by striking out Alex Rodriguez on three pitches with the potential tying run on base.

“It’s about as good as it gets,” Maddon said of playing three consecutive one-run games with first place on the line. “It was incredibly intense on both sides. Both sides were really into every pitch. Every pitch mattered.”

Rays starter James Shields scattered eight hits over 6 1-3 innings, walked two and struck out eight before departing with a 2-1 lead Johnson gave Tampa Bay with his two-run homer off Hughes in the fifth. Johnson has five homers since being called up last month from Triple-A Durham, where he was the International League MVP with 30 homers and 95 RBIs.

The Yankees went back on the top in seventh after plate umpire Lance Barksdale — over the objections of the Rays — ruled that Qualls’ first pitch struck Derek Jeter on the left arm and Granderson followed with his 18th homer.

Jeter, who stood doubled over while receiving attention from a trainer, confessed that the ball hit the end of his bat and he sold the call to Barksdale with a good acting job.

“He told me to go to first base. I’m not going to tell him I’m not going to first, you know,” Jeter said.

“It’s part of the game. My job is to get on base. Fortunately for us it paid off at the time, but I’m sure it would have been a bigger story if we would have won that game.”

Maddon disliked the call, but didn’t fault Jeter.

“If our guys had did it, I would have applauded that. It’s a great peformance on his part,” the Tampa Bay manager said. “Several players are very good at that. And again, I’m not denigrating it. If our guy does it, I’m very happy with that if we end up getting the call. … Fortunately it didn’t cost us.”

Although it will take a major collapse for either team to not make the playoffs, the Yankees and Rays value the division title because of the homefield advantage that comes with it in the postseason.

“There’s no question, we want to win the division. I don’t want to downplay that at all. We know what home field advantage means. We saw what it did for us last year,” Rodriguez said.

The Yankees, who stopped a season-high four-game losing streak on Tuesday, have dropped eight of 10 overall.

“We could have very easily won five of these games,” New York manager Joe Girardi said. “Sometimes you get the big hits, sometimes you don’t.”

Shields has struggled against the Yankees much of his career, going 1-7 with a 6.00 ERA in nine starts against them before this season. He’s been much more effective this year, going 2-0 and outpitching CC Sabathia in a 3-0 victory at Tropicana Field on Aug. 1.

The Yankees had at least one hit in five of the first sixth innings, but were 2 for 7 with runners in scoring position against Shields — with both of the hits coming in the first, when Mark Teixiera’s infield single sent Jeter to third and Robinson Cano’s single to left scored the Yankees captain.

Hughes, who retired 12 in a row to start the game, allowed four runs and six hits over 6 2-3 innings. He walked none and struck out five.

Notes: Maddon reiterated before the game that he had no problem with Crawford’s much-debated decision to tag up and try to advance to third base on a fly ball in the 10th inning Tuesday night. The speedy All-Star outfielder — the potential tying run — was thrown out by rookie Greg Golson, completing a game-ending double play. … Yankees LHP Andy Pettitte, sidelined since June 19 by a strained left groin, is set to rejoin the rotation next Wednesday against Tampa Bay. RHP Javier Vazquez will shift into a long relief role. … Yankees OFs Nick Swisher (left knee) and Brett Gardner (right wrist) remained out of the starting lineup. They could return this weekend.

One Comment

Hey dabooch!, when you become a major league manager then you can tell us how to manage a game. I’m sure last year you screamed like a little girl when the Yankees won the title. Who was the manager? Girardi, and he’s in the hunt again.

Gorardi blew the game, he left hughes in to long had 111 pitches to start 7. No faith in Joba from months ago, Joba pitched great. Why not steal Gardner in ninth, Alex would only need a signal to tie score, not HR.