Orchard Park, N.Y. — Kenny Golladay did everything he could. The Detroit Lions wide receiver ripped away an interception for a 24-yard gain, caught a 40-yard bomb and finished with seven catches for 146 yards, but it wasn’t enough.

Buffalo Bills rookie quarterback Josh Allen connected with wide receiver Robert Foster on a 42-yard touchdown early in the fourth quarter for what proved to be the game-winning score in Sunday’s 14-13 victory over the Lions.

With the loss, and the Minnesota Vikings’ victory over the Miami Dolphins, the Lions (5-9) have been officially eliminated from postseason contention.   

The Lions took a 13-7 lead into the locker room and maintained it through the fourth quarter when Allen connected with Foster for the go-ahead score, capping a four-play, 61-yard drive.

The Lions had an opportunity to re-take the lead on the ensuing possession when a 20-yard Golladay catch put the team in field-goal range. But Matt Prater missed wide right on a 48-yard attempt with 5:55 remaining.

Prior to the miss, Prater had made 15 consecutive field goals, dating back to Week 5.

After’s Prater’s missed field-goal try, the Lions quickly got the ball back by forcing a three-and-out, but returned the favor with a three-and-out of their own.

A third-down stop on the Bills’ next possession, a pass breakup by cornerback Darius Slay, was negated by an offside penalty against linebacker Jarrad Davis. Facing a fourth-and-1, Allen converted a sneak to end the game.

After a scoreless opening quarter, the game briefly turned into a shootout in the second frame with three consecutive touchdown series.

The Lions opened the scoring with a nine-play, 75-yard drive.

Golladay kick-started things with a 31-yard grab down the left sideline and running back Theo Riddick’s 19-yard run gave the Lions first-and-goal from the 3. After two LeGarrette Blount carries went nowhere, quarterback Matthew Stafford found Andy Jones in the back of the end zone from 4 yards out for the first touchdown of the young receiver’s career.

A botched snap on the point-after attempt left the Lions up, 6-0.

The Bills responded with an 87-yard drive. Foster, working against rookie cornerback Mike Ford, hauled in a 28-yard crossing pattern before drawing a 43-yard pass interference call on the next play. Allen punched it in with a 3-yard scramble, eluding blitzing Davis and beating a handful of Lions defenders in a foot race to the pylon to give the Bills a 7-6 edge.

The lead was short-lived thanks to Golladay, who delivered two, huge third-down grabs. On the first, he yanked a sure interception out of the hands of cornerback Levi Wallace, who had jumped his route. A few plays later, Golladay went up over Tre’Davious White down the right sideline for a 40-yard completion, converting a third-and-7 and giving the Lions first-and-goal from the 10.

Zach Zenner, who got the start at running back for Detroit, finished the drive from there with runs of 6, 3 and 1 yard for the score.