MIAMI GARDENS, Fla -- Josh Allen followed up on the most prolific game of his NFL career with an even better one.
The third-year pro threw for 417 yards and four touchdowns, both personal bests, and the Buffalo Bills beat AFC East rival Miami for the fourth consecutive time Sunday, 31-28.
Allen reached a career high in yards passing for the second week in a row, and became the first Buffalo quarterback to have consecutive 300-yard games since Drew Bledsoe in 2002.
"There are games when the offense has to step up," Allen said. "This was one of those games."
Trailing 20-17, the Bills (2-0) reclaimed the lead for good with 6 minutes left on a 6-yard touchdown pass from Allen to rookie Gabriel Davis, who made a diving catch in the end zone.
Allen's 46-yard touchdown pass to John Brown sealed the win.
"He's got ice water in his veins," coach Sean McDermott said. "No moment is too big for him."
The only other Bills player to throw for at least 415 yards and four scores was Joe Ferguson in 1983.
Allen led an offense that totaled 524 yards, including 342 in the first half, the Bills' most since 2000.
"He has improved a lot," Miami cornerback Xavien Howard said. "I knew he had a strong arm and could throw the ball deep, but he has gotten better at making decisions with the ball."
The Dolphins have become Allen's favorite foil: He has thrown for 12 touchdowns, rushed for three and thrown one interception in his past four games against Miami. Of his 36 career TD passes, 14 have come against the Dolphins.
With the Bills leading 17-10, the game was suspended for 36 minutes in the third quarter due to lightning in the area. After the delay, the Dolphins offense got a spark and scored 10 consecutive points to take a 20-17 lead.
"There was no panic," Allen said. "It was just, `Let's go. Let's get six."
He finished with touchdown passes to four receivers, and Stefon Diggs led the Bills with eight catches for 153 yards.
"I would hate to be on the other side," running back Devin Singletary said. "You know what I'm saying? It's definitely a great combination, those two guys, and it's only getting better."
The Dolphins had a first down at the Buffalo 1 late in the third quarter but failed to score, with Preston Williams dropping a fourth-down pass that could have given them the lead.
"We didn't do enough to win the game," coach Brian Flores said. "We couldn't finish. You've got to finish in this league if you want to win."
The Dolphins closed to 31-28 on an 8-yard touchdown pass from Ryan Fitzpatrick to Mike Gesicki and a successful 2-point conversion with 49 seconds left. The Bills' Micah Hyde recovered the ensuing onside kick.
Fitzpatrick went 31 for 47 for 328 yards and two TDs. Mike Gesicki had eight catches for 130 yards and a touchdown, but the Bills' defense did just enough.
"The offense picked us up," Bills safety Micah Hyde said. "We couldn't get off the field. But I love what they are doing on offense, They had our back today."
The Bills took a 7-0 lead on a 97-yard drive that culminated with a 1-yard pass to Reggie Gilliam. It was the first NFL touchdown reception for Gilliam, an undrafted free agent out of Toledo.
Masked fans were scattered throughout the stadium, and the announced crowd of 11,075 was smaller than the maximum of 13,000 being allowed to attend the home opener. Almost half of the spectators wore Bills colors.
Groups of spectators were required to space at least 6 feet apart in both the lower bowl and upper deck. The crowd was less than 20% of the stadium's capacity.
"It was awesome to have fans there. It felt good to get some people back in the stadium," Gesicki said. "We've got to win some games for them."
Both teams stayed in the locker room for the playing of "The Star-Spangled Banner."
Dolphins: play Thursday night at Jacksonville for the first time since 2015.
Bills: host the Rams next Sunday. The teams last met in 2016.
More AP NFL: https://apnews.com/NFL and https://twitter.com/AP-NFL
Mahomes exits game after big hit
Chiefs QB Patrick Mahomes is ruled out for the rest of Sunday's playoff game against the Browns after taking a big hit and having to be helped off the field.
Baltimore Ravens to release veteran RB Mark Ingram, sources say
Running back Mark Ingram will be released by the Ravens on Tuesday, league sources told ESPN's Adam Schefter.
Brady trolls ref with high-five after TD
Tom Brady sneaks in for a 1-yard touchdown, then walks up to an official and offers a fake high-five in celebration.
Jon Arnett, star RB for USC Trojans and Los Angeles Rams, dies at 85
Jon Arnett, one of USC's greatest running backs who went on to become a five-time Pro Bowl player for the Los Angeles Rams, died on Saturday at age 85.
Baltimore Ravens' Lamar Jackson shouts out 'Bills Mafia' for donating $360,000 to charity
Lamar Jackson expressed gratitude to Bills fans, whose donations reached $360,000 to Louisville's "Blessings in a Backpack" chapter.
NFL changes 2021 scouting combine format because of COVID-19 pandemic
The combine, which has been held in Indianapolis since 1987, will be altered because of COVID-19 precautions, the NFL informed teams on Monday in a memo detailing the format changes.