ST. PETERSBURG -- Tim Beckham hit a walk-off single with the bases loaded in the bottom of the ninth inning as the Rays stole a victory away from the Blue Jays with a 4-3 win on Saturday night at Tropicana Field. The loss dropped Toronto to one game behind Kansas City for the best record in the American League, with home-field advantage throughout the postseason on the line.

Blue Jays closer Roberto Osuna immediately got into some trouble in the ninth when he allowed a leadoff double to Grady Sizemore. The rookie reliever battled back by retiring the next two batters he faced, but then ran into some command issues as he walked the next two batters to load the bases. Beckham then delivered the big blow with a single to left on an 0-1 fastball that was up in the zone.

"Felt good to get the hit," Beckham said. "The past couple of days I haven't felt myself at the plate. I just wanted to zero in, and it felt good to be put in a situation like that, to challenge myself when I'm struggling."

The team that finishes with the AL's best record will host the winner of Tuesday's AL Wild Card Game presented by Budweiser, while the second-place team will face the winner of the AL West. The Blue Jays previously clinched home-field advantage for the AL Division Series, but home field in the AL Championship Series remains up for grabs if both they and the Royals advance. The Royals can clinch Sunday afternoon with a win over Minnesota.

"He got into trouble and then they got a hit to beat us," Blue Jays manager John Gibbons said. "We played a heck of a game, we played really good and then, of course, the leadoff double. I thought we were out of that, but Beckham came through with the big hit. That happens. Osuna will be fine."

The loss spoiled yet another solid outing by Toronto right-hander Marco Estrada, who entered the game having tossed 16 2/3 scoreless innings in his previous two outings against Tampa Bay. That streak ended when John Jaso led off the game with a solo homer, but the righty quickly settled in after that. Estrada retired 14 consecutive batters during a stretch that began in the second and lasted until Asdrubal Cabrera hit a solo shot in the seventh.

Cabrera's solo tater

TOR@TB: Cabrera launches a solo jack to right field

10/3/15: Asdrubal Cabrera cuts the Rays' deficit to one run in the 7th with a solo homer over the wall in right field

The 32-year-old Estrada was in line for his 14th victory of the season until Toronto's late collapse, and he finished the regular season with a sparkling 3.13 ERA. There was a time when his spot in the rotation for the postseason was a question mark, but his performance suggested otherwise, and it's clear he will be a starter when the Blue Jays open their ALDS next week against a team that has yet to be determined.

Estrada strikes out nine

TOR@TB: Estrada fans nine over 6 2/3 excellent frames

10/3/15: Marco Estrada goes 6 2/3 innings, allowing two runs on three hits and no walks while striking out nine

"I'm just thankful for the opportunity," Estrada said of his season. "I started in the bullpen and they told me, 'Hey, just be ready. You'll get your shot to start.' I'm just thankful for the opportunity that they gave me, and I ran with it, I guess. I had a pretty good year, but it's not over. We have a long way to go."

Rays right-hander Chris Archer also put the finishing touches on an impressive season, as he limited the potent Blue Jays lineup to one run over five innings. He allowed five hits and one walk while striking out three to lower his season ERA to 3.23, but he finishes with a 12-13 thanks largely to a lack of run support at times throughout the year.

Archer goes five in final start

TOR@TB: Archer goes five strong in last start of 2015

10/3/15: Chris Archer tosses five frames, allowing one run on five hits and one walk while striking out three in his last start of 2015

MOMENTS THAT MATTEREDThe quest for 40: The possibility of Encarnacion reaching 40 home runs seemed almost impossible a couple of weeks ago, but a lot has changed since then. He hit a two-run shot in the top of the sixth inning for his 39th of the year to give Toronto a 3-1 lead. Encarnacion has homered in his last four games, and is one dinger shy of reaching 40 for the second time in his career, and first since 2012.

Encarnacion's 39th home run

TOR@TB: Encarnacion rips two-run shot for 39th homer

10/3/15: Edwin Encarnacion gives the Blue Jays a 3-1 lead in the 6th with a two-run shot to left field, his 39th home run of the season

If Encarnacion reaches 40 homers on Sunday, that would give Toronto three players with at least 40 home runs in the same season, which has only been done three times before. Colorado had three players with 40 homers in 1996-97 and Atlanta in 1973.

"It doesn't get any better than that," Gibbons said. "Three guys, that's what they do, that's how they are and we're fortunate we have them one, two, three, back-to-back-to-back. They've all had huge years and they've been a huge part in getting us to this point right now. They're dangerous, every one of them. One swing of the bat they can change the game. They all have good discipline; they're not just up there hitting home runs. They have an idea of what they're doing at the plate and it's tough to pitch to."

Jaso kick-start: Jaso homered on a 2-2 pitch from Estrada to lead off the Rays' half of the first. Jaso's fifth home run of the season was his fourth career leadoff one. He last did it on May 14, 2014, against the White Sox when he played for Oakland.

Jaso's leadoff homer

TOR@TB: Jaso leads off the 1st with a long home run

10/3/15: John Jaso leads off the bottom of the 1st with a no-doubter to right field off Marco Estrada to stake the Rays to an early lead

Archer does the unusual: Archer reached 250 K's for the season when he struck out the first batter of the game, Ben Revere. By doing so, Archer joined an unusual group: Pitchers to record at least 250 strikeouts without posting a winning record that season. Only six other pitchers have achieved this rare feat: Ben Sheets, Brewers (2004); Roger Clemens, Red Sox (1996); and Hall of Famers Nolan Ryan, Angels/Astros ('76, '78, '87); Steve Carlton, Phillies ('83); Phil Niekro, Braves ('77); and Ed Walsh, White Sox (1910). More >

QUOTABLE
"We're not playing for much right now, other than to win ballgames. I think we all know how our guys take a lot of pride in going out and playing, the effort level they've shown every day. And that's a pretty impressive team win right there, to do it off that group, off that guy who was on the mound. ... That was the ballgame." -- Rays manager Kevin Cash

"It was a great pitch over there. He was looking for that and he hit it pretty well. I wasn't able to come back." -- Osuna, on the leadoff double by Sizemore

SOUND SMART WITH YOUR FRIENDS
Jaso's home run allowed the Rays to tie a Major League record by giving them 15 players with at least five home runs this season. Other teams that have turned the trick include the 2013 Cubs, 2012 Astros, 2007 Rangers and 2002 A's.

Josh Donaldson, Jose Bautista and Encarnacion have combined to hit 120 home runs this year, which is the most by any trio in franchise history. The record previously belonged to Jose Canseco, Carlos Delgado and Shawn Green, who combined to hit 119 in 1998.

WHAT'S NEXTBlue Jays: The Blue Jays have yet to officially announce a starter for Sunday's 2:10 p.m. ET regular-season finale against the Rays, but if left-hander Mark Buehrle is up for it, he'll get the ball. Buehrle tossed 6 2/3 innings on Friday night against Tampa Bay, which left him two innings shy of reaching 200 innings for the 15th consecutive year. The Blue Jays want him to reach that milestone, and the tentative plan is to have Buehrle start and throw two innings. If Buehrle isn't physically capable of doing that, then the outing will go to right-hander Drew Hutchison. Either way, the bullpen is expected to get a lot of work.

Rays:Matt Moore (2-4, 5.84 ERA) starts for the Rays on Sunday, hoping to head into the offseason on a high note. Moore is trending in the right direction after pitching into the seventh inning in three consecutive starts. Prior to that stretch, he had gone five innings or fewer in his first eight starts of the season (all coming after his return from Tommy John surgery).