Josh Allen threw three touchdown passes, James Cook rushed for 108 yards and a score, and the Buffalo Bills took down the Miami Dolphins 31-21 Thursday night in Orchard Park, New York.

Allen completed 22 of 28 attempts for 213 yards, and his go-ahead strike to Khalil Shakir was the 200th regular-season TD pass of his career. Cook tied a franchise record by scoring a rushing touchdown for the seventh straight game dating to last season.

Terrel Bernard intercepted Tua Tagovailoa to end a late scoring threat and help Buffalo (3-0) stay undefeated. The Bills have won 13 of the past 14 regular-season meetings with the Dolphins.