ORCHARD PARK, N.Y. (AP) — Jay Ajayi ran for 206 yards and broke loose for a 53-yarder in overtime to set up Andrew Franks' 27-yard field goal with 47 seconds left to lead the Miami Dolphins to a 34-31 win over the Buffalo Bills on Saturday.
In winning for the ninth time in 10 games, the Dolphins (10-5) inched closer to their first playoff berth since 2008.
Miami 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.
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.
Two of Ajayi's 200-yard games have come against Buffalo. He had a career-best 214 yards rushing and a score in the Dolphins' 28-25 win over Buffalo at Miami on Oct. 23.
Though the Bills vowed to contain Ajayi, he broke loose on the first play from scrimmage on Miami's second and final possession of overtime.
With Miami backed up at its 15, Ajayi took the handoff and stiff-armed defensive lineman Leger Douzable at the line of scrimmage in finding a crease off left tackle.
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, who is out with a sprained left knee.
DeVante Parker caught a 56-yard touchdown pass and Kenny Stills scored on a 6-yard catch.
Backup running back Kenyan Drake also scored on a 45-yard run .
The Bills' defense squandered what was one of the team's best offensive outings. Buffalo finished with 589 yards to beat the previous mark of 582 set against Miami on Sept. 1, 1991.
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.
Sammy Watkins had 154 yards receiving and a touchdown. LeSean McCoy had 128 yards rushing and also scored once.
The Dolphins appeared to be in control when Moore hit Stills for a touchdown to put Miami ahead 28-14 with 3:14 left in the third quarter.
The Bills responded by scoring 17 points on their next three possessions.