ORCHARD PARK, N.Y. — After putting the Bills ahead with his arm, Josh Allen sealed Buffalo's 14-13 victory over the Detroit Lions with his leaping legs.

All the rookie quarterback needed was a push.

That's the way fullback Patrick DiMarco described Allen's 2-yard leap to convert a fourth-and-1 at the Lions 41 with 1:47 remaining.

"He said, 'Give me the freaking ball,' and then he said, 'Pat, push me,'" said the fullback, who provided Allen a nudge to get him over the top of the pile. "He's competitive. He's tough. He's everything you want as a leader. This franchise is going to be good with him around."

Allen hit rookie Robert Foster in stride for a 42-yard go-ahead touchdown pass with 10:26 remaining, and the Bills hung on to eliminate the Lions from playoff contention.

Allen improved to 4-5 in nine starts this season, and won for the third time with Buffalo trailing or tied in the fourth quarter.

The Bills (5-9) snapped a two-game skid and won despite finishing the game minus their top three running backs. Starter LeSean McCoy (left hamstring) and backup Chris Ivory (left shoulder) were inactive and then Marcus Murphy did not return after dislocating his left elbow in the second quarter.

The Lions (5-9) lost despite second-year receiver Kenny Golladay finishing with a career-best 146 yards receiving, and will finish with a losing record for the first time since going 7-9 in 2015.

"Yeah, it's frustrating. You play this game for the opportunity to play in the playoffs," quarterback Matthew Stafford said. "We had our chances. We had our opportunities, just didn't make enough plays."

The Lions' special teams helped cost them.

Detroit opened the scoring on Stafford's 4-yard touchdown pass to Andy Jones, but botched the extra-point attempt on Don Muhlbach's bad snap.

Then, following Foster's touchdown, Stafford responded by marching the Lions 45 yards on the next possession only to have kicker Matt Prater miss a 48-yard field goal wide right.

"I don't have an excuse," said Prater, who entered having hit his previous 14 field-goal attempts. "I let everybody down, including myself."

First-year coach Matt Patricia said there was plenty of blame to go around.

"There's plenty of situations out there on the field where we could do more to do better to help us win," Patricia said. "It starts with me. Have to go out and execute better."

Stafford wasn't the problem in continuing to build chemistry with Golladay on an offence missing leading rusher Kerryon Johnson (knee), and with veteran receiver Marvin Jones Jr. on injured reserve.

A week after managing just 101 yards passing — the second-fewest in his career — in a 17-3 win at Arizona, Stafford topped that number in the first half alone with 137 yards passing, including 115 to Golladay.

Allen showed he's capable of winning with his arm. He finished with just 16 yards rushing after becoming just the second quarterback in NFL history to top 95 yards rushing in three consecutive games.

"I don't know if the stats are very good, I haven't seen them. But I think it comes down to the team," Allen said, providing credit to the defence. "It was a collective effort."

Bills safety Micah Hyde made a point to head over to Allen's locker and tap him on the back following the game.

"I just said, 'Keep being yourself, man,'" Hyde said. "He has heart. He plays with heart. He wears it on his sleeves and we all appreciate that."

FOSTER CATCHING ON

Foster, an undrafted rookie out of Alabama, has combined for 438 yards receiving and two touchdowns in his past five games since being activated from the practice squad.

He has topped 100 yards receiving in three of his past five games, including a 104-yard outing in a 27-23 loss to the Jets last weekend. He's Buffalo's first player to top 100 yards receiving in consecutive games since Sammy Watkins in Weeks 11 and 12 in 2015.

PICKING ON TRE'DAVIOUS WHITE

Stafford went at the strength of the Bills secondary in beating Buffalo's top cornerback Tre'Davious White.

Golladay was falling backward to make a 33-yard catch even though White was flagged for pass interference to set up Detroit's first scoring drive, capped by Stafford's 4-yard pass to Jones.

Trailing 7-6, Stafford floated a pass up the right sideline which Golladay caught by outjumping White for a 40-yard completion. The Lions scored three plays later on Zach Zenner's 1-yard plunge.

NOT-SO-SPECIAL TEAMS

A hip injury that bothered Bills kicker Stephen Hauschka came into play on Buffalo's first possession, and after Allen was sacked for a 9-yard loss on third-and-9 at Detroit's 29. Rather than have Hauschka attempt a 50-plus-yard field goal, the Bills punted. Hauschka was hurt when being blindsided by Jets defensive lineman Henry Anderson last week.

UP NEXT

Lions: Close home schedule against Minnesota next Sunday.

Bills: Close road schedule at New England next Sunday.

___

More AP NFL: https://apnews.com/NFL and https://twitter.com/AP_NFL