ORCHARD PARK, N.Y. (AP) Jay Ajayi stiff-armed his way to his third 200-yard rushing performance of the season.

In the process, the second-year running back carried the Miami Dolphins one giant step closer to clinching their first playoff berth since 2008.

Ajayi had 206 yards rushing and a touchdown, and broke loose for a 57-yard run in overtime to set up Andrew Franks' 27-yard field goal with 47 seconds left in a 34-31 win over the Buffalo Bills on Saturday.

''It's about running hard through the whole game and finishing strong,'' Ajayi said. ''Division rival game, December game, a lot was on the line. Tensions were high today.''

Ajayi relieved the tension with Miami taking over at its 15 with four minutes left.

Ajayi took the handoff and stiff-armed defensive lineman Leger Douzable at the line of scrimmage in finding a crease off left tackle before being brought down at the Buffalo 28. The Dolphins ran five more plays before Franks lined up for the decisive score.

''Oh, man, he's a grinder. He's a workhorse,'' tight end Dion Sims said. ''He goes 100 miles an hour, and that's why he's got the nickname `Train,' because he's just going nonstop.''

In winning for the ninth time in 10 games, the Dolphins (10-5) can secure the AFC's final wild-card berth as early as Sunday if Denver loses to Kansas City.

Denver needs to win its final two games to make the postseason and Baltimore is eliminated from the wild-card race and can only make the playoffs as the AFC North champion.

The Bills (7-8) were eliminated from contention and extended the NFL's longest active playoff drought to 17 seasons.

Buffalo's drought is tied for the fifth longest in NFL history, and the longest since the New Orleans Saints went 20 years before qualifying for the playoffs for the first time in franchise history in 1987.

The Bills couldn't stop Ajayi even though they vowed to do so after he had 214 yards rushing in a 28-25 win at Miami on Oct. 23.

''Like come on,'' safety Corey Graham said in frustration. ''I've never been part of anything like that. I've never seen anything like that. I don't get it.''

Ajayi is the fourth player in NFL history to have at least three games with at least 200 rushing yards in a season. Earl Campbell, OJ Simpson, Tiki Barber are the others.

Franks forced overtime by hitting a career-best 55-yard field goal with 6 seconds remaining.

The Bills overcame a 14-point deficit three times before taking their first lead of the game with 1:20 left. That's when Tyrod Taylor converted a fourth-and-7 by completing a pass to Charles Clay in the end zone.

The Bills squandered a scoring chance on the first possession of overtime when Dan Carpenter missed wide right from 45 yards with 10:03 remaining. Carpenter also missed wide right on a 46-yard attempt in the first quarter.

The focus of attention in Buffalo now turns to coach Rex Ryan's job security.

Rather building a bully as Ryan promised upon taking over in January 2015, his defense has instead been a pushover.

Buffalo has allowed 200 yards rushing three times this season, including a franchise-worst 236 yards to Le'Veon Bell in a 27-20 loss to Pittsburgh two weeks ago.

''Obviously, this is a rough night,'' Ryan said. ''I'll let my reputation stand for what it is and you can challenge it all you want.''

It didn't help that Ryan revealed the Bills only had 10 players on the field when Ajayi took off in overtime. No one took into account that cornerback Stephon Gilmore was pulled from the game and placed in concussion protocol.

Buffalo finished with 589 yards to beat the previous mark of 582 set against Miami on Sept. 1, 1991.

BY THE NUMBERS

Dolphins: QB Matt Moore finished 16 of 30 for 233 yards and two touchdowns and an interception in making his second consecutive start in place of Ryan Tannehill (sprained left knee).

Bills: Taylor went 23 of 39 for a career-high 329 yards passing and three touchdowns. He became Buffalo's first player to top 300 yards since journeyman Kyle Orton had 329 yards in a 26-24 loss at Oakland nearly two years ago to the day. LeSean McCoy had 128 yards rushing and also scored once.

REPLAY CHALLENGE: Replays showed Ryan and safety Corey White attempting to call timeout as Franks lined up to kick his game-tying 55-yard attempt to force overtime.

It appeared that Ryan was a split-second late in calling time. What's unclear is if White's motion was before the snap.

Referee Craig Wrolstad said head linesman Mark Hittner ruled Ryan called timeout after the snap, and added the play is not reviewable.

BAD TACKLING: Missed tackles led to Miami scoring its first three touchdowns in building a 21-7 lead 2:55 into the second half.

Ajayi opened the scoring on a 2-yard run by shedding Douzable and then stiff-arming safety Sergio Brown.

Kenyan Drake scored on a 45-yard run by finding no hole up the middle and then bouncing his way up the right side by beating linebacker Jerry Hughes to the edge.

WR DeVante Parker's 56-yard touchdown began with him making a short catch over the middle and having cornerback Nickell Robey-Coleman bounce off him.

NEXT UP

Dolphins: Close regular season hosting New England Patriots on Jan. 1.

Bills: Close regular season at New York Jets on Jan. 1.

---

For more NFL coverage: http://www.pro32.ap.org and http://www.twitter.com/AP-NFL

Copyright 2016 by STATS LLC. Any commercial use or distribution without the express written consent of STATS LLC is strictly prohibited.