NEW YORK -- Little things go wrong when a team finds itself in a funk, so the Rays should have expected what they got on Tuesday night.

Yes, the game ended when Nick Swisher hit a walk-off home run off Dan Wheeler in the bottom of the ninth inning to give the Yankees a 3-2 win with 45,350 watching at Yankee Stadium. But it felt like it was over long before Swisher's second home run of the game landed in the right-field stands.

By losing, the Rays dropped their seventh consecutive game, extending their season-high losing streak, and fell 8 1/2 games behind the Red Sox in the American League Wild Card race. The current skid is the team's worst since it dropped seven in a row prior to last season's All-Star break. Making their plight look dire is the fact the Rays are running out of time, with just 23 games remaining on their regular-season schedule.

"It's no fun, is it?" Rays manager Joe Maddon said. "Several days ago, we were in decent shape. The homestand hurt us because we normally do decent there. ... That's just been the pattern of late. A lot of close games have gotten us late. We just have to do better now."

Maddon managed a smile when asked where the Rays stand now if they were in "decent shape" before this losing streak.

"Less than decent -- very indecent," Maddon said. "It's indecent exposure right now. ... The inches have been going against us. We have to regain them somehow."

Trouble for the Rays began to brew in the first inning after Carl Crawford hit a one-out triple. Evan Longoria grounded to third base, and Crawford got caught in a rundown and was eventually tagged out to kill the scoring opportunity.

That would prove to be the first of four baserunning gaffes by the Rays on the night.

In the fourth, Ben Zobrist got thrown out at second base on a "strike-em-out, throw-em-out" play after Pat Burrell went down on strikes; Chris Richard got doubled off first base on a line drive for a double play to end the fifth; and Crawford got picked off of first by Yankees starter Chad Gaudin to end the sixth.

"It is tough," said Maddon in reference to the four outs made on the bases. "Even if Carl had gone on contact, he might have been out at the plate also. When Zobrist got thrown out, that is a 3-2 count where you're trying to stay out of a double play one way and you get in a bind the other way. Of course, getting picked off at first is not desirable. I would say 99 percent of Major Leaguers would get doubled up [when Richard got doubled off at first]."

Longoria homered off Gaudin to lead off the seventh, and Jason Bartlett homered off Phil Hughes to lead off the eighth and the game at 2. Until Bartlett's home run, Hughes had not allowed a hit for a span of 20 consecutive batters, which was the longest stretch in the Major Leagues.

Wheeler retired the first batter of the ninth inning, Alex Rodriguez, on a groundout before Swisher hit a 1-0 fastball that just cleared the fence for the win.

"I don't care if it goes over by one foot or 50 feet -- I'll take it," Swisher said.

Wheeler wanted to locate the pitch down and away.

"It just didn't get there," Wheeler said. "You really have to be fine with these guys. Talk about a great lineup. Any one of them can do it. You just have to make your pitches. That was the one pitch I didn't make, and it just got out."

Wheeler's mistake perpetuated a bad run by the Rays' bullpen that has seen them post a 2-10 record since Aug. 6. After allowing the game-winning homer, Wheeler just stood and watched in frustration.

"Obviously, I'm a little annoyed," Wheeler said. "I'm just trying to get out of this little slump right now. ... We just need a victory. We had chances today. It's a tied game if I get us out there. Who knows what might happen? That was more, just, shock."

David Price provided a quality start for the Rays, allowing a solo home run to Swisher in the second inning and an RBI single to Rodriguez in the sixth, but the left-hander came away with a no-decision for his six innings.

"We're still in it, I guess -- we're not out," Crawford said. "Anything can happen. But it's going to be tough. It's a tough uphill battle. We just have to keep playing the games out and see what happens."