The benefit of playing in a weak division, as everyone knows and the Yankees know better than most, is that being mediocre can put you in contention.

The drawback, as the Yankees are learning, is that everybody else can be mediocre enough to feel like a contender, too.

Sure enough, the Rays came into Yankee Stadium for Monday night's game more emboldened than a last-place team usually is, and left the game with an even better feeling. The visitors withstood Brian Roberts' tying home run in the bottom of the ninth and won, 4-3, on Logan Forsythe's single in the 12th against a club that has lost seven of nine.

It was unsettling, even as the Yankees seem to have settled into the tepid AL East race. They never led and fell behind one last time after Brandon Guyer drew a two-out walk in the 12th against Jose Ramirez (0-2). Guyer stole second and scored on Forsythe's hit up the middle. It was the third inning in which the Yankees retired the first two Rays batters and still allowed a run.

Joe Girardi said his team is lucky to have reached the halfway point in contention. "I think probably every team in this division feels that they're somewhat fortunate to be in this position with the records that we have. Being 41-40, you wouldn't usually think that you'd be right in the thick of it, but we are," he said, adding that offensive productivity and innings from starting pitchers are areas to improve.

Brian McCann referred to the former when he said, "I'm a big reason for that. Our pitching staff has been a big reason that we're at where we're at [in contention].'' When he was asked to give himself a midterm grade, he said: "Horrible. I feel good behind the plate, but swinging the bat, I've got to do a lot better.''

The Yankees did prevent Rays starter Chris Archer from entering the record book. He had a chance to become the first pitcher since Walter Johnson in 1907-08 to go 5-0 in his first five career games against the Yankees -- "baseball history is super-interesting,'' he said Sunday when informed of the possibility -- and he looked like a good bet until Roberts took Joel Peralta deep with one out in the ninth.

As they officially reached the midway point with their 81st game, the Yankees had the choice of seeing their season as the proverbial glass half empty or half full.

Before the game, Girardi called the year so far "up and down. We've been kind of streaky, like a lot of teams in our division. We've had to deal with our share of situations to our pitching staff. We've had some people that have really stepped up. We've had some people that have had some slow starts. But you look at it 80 games in, we're right in the middle of it.''

Brian Cashman sounded as if he would prefer a new glass, or at least some new contents. "I don't care about the division. I care about us," he said, clearly unsatisfied with the first 80. "I wouldn't have predicted this for anybody in the division."

Still, here they were, having lost two of three to the Red Sox, who left the Bronx feeling revived, and facing the Rays, who came in feeling the same way after winning three of four in Baltimore. Despite entering 14 games under .500 and 10 games out of first, the Rays said they felt like contenders. "Why not?'' manager Joe Maddon said. "We probably picked the right year in the sense that there's a lot of bunching up going on right now and parity is at an all-time high, if that makes any sense."

Archer was given a 2-0 lead on home runs (both deep, both on full counts) by Matt Joyce and Kevin Kiermaier in the first and third against David Phelps.

The Yankees made it 2-2 in the bottom of the third as Archer hit Ichiro Suzuki, Brett Gardner grounded an RBI triple into the rightfield corner and Derek Jeter drove him in with a grounder to second.

Dellin Betances was charged with the go-ahead run in the eighth after allowing a pair of two-out walks. After turning an 0-and-2 count into a walk to Forsythe, he was replaced by David Robertson, who allowed Ryan Hanigan's go-ahead single.

Meanwhile, Archer overcame being hit in the foot by Carlos Beltran's single in the sixth. That didn't hurt him. The whole night didn't hurt his team's feeling about its place in the division's shallow water, either.

The Yankees were the ones with the hurt feelings. "It's been up and down,'' Girardi said. "We've had our share of issues that we've had to deal with, like a lot of the other clubs in this division. But we're still in the thick of it. It's going to come down to 81 more games."