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
Mother of Baltimore Ravens guard D.J. Fluker's child faces kidnapping charge
The mother of Baltimore Ravens offensive guard D.J. Fluker's child faces a misdemeanor kidnapping charge.
Former Pro Bowl safety Earl Thomas to visit Houston, will likely sign with Texans, source says
A seven-time Pro Bowl selection and three-time All-Pro at safety, Earl Thomas is closing in on signing with the Houston Texans, a source told ESPN on Monday.
Indianapolis Colts WR Michael Pittman Jr. out indefinitely after surgery
Colts rookie wide receiver Michael Pittman Jr. underwent unexpected surgery for compartment leg syndrome in his calf and is out indefinitely.
Green Bay Packers LB Christian Kirksey out at least one game, source says
Packers linebacker Christian Kirksey will miss at least one game because of a shoulder injury he suffered in Sunday night's win over the Saints, a source told ESPN's Rob Demovsky.
Brady leads Bucs to win with 3-touchdown half
Tom Brady throws for three touchdowns, including two to Mike Evans in the first half, and that's all Tampa Bay needs in a 28-10 win over the Broncos.
After victory, Matt Patricia keeps proper perspective, focuses on Detroit Lions 'being consistent'
Trying to avoid the roller coaster of emotions that comes with life as an NFL coach, Detroit's Matt Patricia is focused on getting his Lions to focus on consistency as they look to build off their first win.