Things looked bleak for the Bills when they lost to the Broncos on a Monday night in Week 10 and fell to 5-5 on the season.
But despite the club's struggles early in the season, Buffalo wasn't out of trouble. The franchise proved that by winning five of its last six games and setting up a Week 18 matchup with the Dolphins for the division title.
And so on Sunday night, Buffalo used a fourth-quarter surge to beat Miami 21-14 and win the AFC East for the fourth straight year.
The Bills trailed 14-7 early in the final period, with Josh Allen committing three turnovers to help the Dolphins stay ahead. But Deonte Harty took a punt return 96 yards for a touchdown, tying the game at 14-14 with 13:42 left.
Then, when the Dolphins made a three-pointer, the Bills responded with their second touchdown drive of the game. Allen hit Dawson Knox on a 5-yard scoring strike, giving Buffalo a seven-point lead that held until the end of the game.
The Bills had a chance to tie the game on offense, but Allen's fourth down sneak failed. With just under 90 seconds left in the contest, the Dolphins even moved into Buffalo territory.
But on second-and-10 from the Bills' 40, Tua Tagovailoa was intercepted by safety Taylor Rapp on a pass intended for Chase Claypool, who appeared to be well covered.
That sealed Buffalo's victory, the division title and the No. 2 seed in the AFC.
Allen finished the game completing 30 of 38 passes for 358 yards with two touchdowns, two interceptions and a lost fumble. He also ran 15 times for 67 yards. Khalil Shakir led the Bills with six catches for 105 yards, while Stefon Diggs had seven catches for 87 yards.
Without Allen's turnovers, the game would have been a loss. Buffalo finished the game with 473 yards, 26 first downs and 9 of 15 on third down – an average of 6.1 yards per play.
On the other hand, Tagovailoa was 17 of 27 for 173 yards with one touchdown and two picks. Hill finished the game with seven catches for 82 yards and a touchdown.
The Dolphins had just 275 yards, 16 first downs and were 4 of 10 on third down.
With the win, the Bills will now host the No. 7 Steelers in the wild card round next Sunday afternoon.
After leading the AFC East all season, the Dolphins lost their last three of their last five games, dropping them to the No. 6 seed in the conference. Miami will travel to what is expected to be a frigid Kansas City to play the Chiefs on Saturday night, a game that will be broadcast exclusively on Peacock.