DETROIT (AP)Tyler Bass made a tiebreaking 45-yard field goal with 2 seconds left, lifting the Buffalo Bills to a 28-25 win over the Detroit Lions on Thursday for their second victory in five days at Ford Field.

Josh Allen set up the game-winning kick by starting the drive with a 36-yard pass to Stefon Diggs and running twice for 12 yards.

Buffalo (8-3) has won two straight to move a half-game ahead of Miami in the AFC East.

The Bills were back in Detroit after the NFL shifted their previous home game against Cleveland to Ford Field because of a winter storm dumping several feet of snow in western New York. They had to work harder for the win on Thursday than they did against the Browns. Bass was 6 for 6 on field goals in the 31-23 win over Cleveland.

Allen threw a go-ahead, 5-yard touchdown pass to Diggs with 2:40 left, but Bass missed the extra point to make it 25-22.

The Lions converted fourth-and-1 from midfield with Amon-Ra St. Brown’s 7-yard end-around to set up Michael Badgley’s game-tying, 51-yard field goal with 23 seconds to go. Badgley missed a 29-yard field goal late in the third and Jared Goff took a sack for a safety in the same quarter and those mistakes proved to be costly.

Allen had a passing and rushing touchdown in the first half, finishing 24 of 42 for 253 yards to more than make up for throwing his 11th interception of the season.

Detroit (4-7) missed an opportunity to win four straight games for the first time since 2016 and lost a franchise-record sixth straight game on Thanksgiving.

COWBOYS 28, GIANTS 20

ARLINGTON, Texas (AP) – Dak Prescott threw two touchdown passes to tight end Dalton Schultz, Ezekiel Elliott ran for a score and Dallas beat New York.

Rookie Peyton Hendershot ran for a 2-yard TD for Dallas. The victory ended a three-game losing streak on the holiday for the Cowboys (8-3), who moved a game ahead of the Giants in the NFC East while sweeping the season series.

Prescott’s TD tosses to Schultz came about five minutes apart in the third quarter, turning a 13-7 deficit into a 21-13 lead.

Saquon Barkley was held to 39 yards rushing with a 1-yard TD behind a makeshift offensive line missing three starters because of injury in the third loss in the past four games for the Giants (7-4).

Dallas, the NFL leader in sacks coming in, dropped Daniel Jones three times while limiting him to 14 yards rushing.

CeeDee Lamb had six catches for 106 yards and set up three Dallas touchdowns, starting with a 25-yard catch before Elliott’s 6-yard run.

Elliott had a season-high 92 yards rushing, and the Cowboys overcame two interceptions from Prescott, who threw for 261 yards.

AP NFL coverage: https://apnews.com/hub/nfl and https://twitter.com/AP-NFL