PITTSBURGH (AP) — Josh Allen threw a 14-yard touchdown pass to Tyler Kroft with 7:55 to play and the Buffalo Bills clinched a playoff spot, beating the Pittsburgh Steelers 17-10 on Sunday night.

The Bills secured their second playoff berth in three seasons under coach Sean McDermott, a college teammate with Steelers coach Mike Tomlin at William & Mary. Buffalo trailed 10-7, but scored on two possessions in the fourth quarter, as Allen rallied the Bills for a comeback win for the fifth time this season. Consecutive interceptions by Jordan Poyer and Levi Wallace on Pittsburgh’s last two possessions sealed the victory.

The surging Steelers (8-6) had an opportunity to leapfrog the Bills for the top AFC wildcard spot, but Buffalo snapped Pittsburgh’s three-game win streak.

NFL BROTHERS TO ACCOMPLISH FEAT FOR FIRST TIME SINCE 1927

Buffalo (10-4) won for the fourth time in five games and recorded its first 10-win season since 1999. The Bills also beat the Steelers for the second time ever in Pittsburgh, first since a 21-point win in the 1993 AFC Divisional playoff round.

The Bills, who improved to 6-1 on the road, made their first Sunday night appearance in 12 years when they were dismantled by the Patriots in a 46-point loss.

Not this group, led by a No. 3-ranked defense and an opportunistic offense.

The Bills no longer resemble the inept franchise with a revolving door of coaches, general managers and quarterbacks that struggled through a 17-year playoff drought before McDermott and general manager Brandon Beane arrived.

Allen completed 13 of 25 passes for 139 yards with a touchdown and an interception. Allen, who also rushed for a score, has only lost consecutive games once in his career. Kroft scored his first touchdown since 2017 when he played for Cincinnati. Devin Singletary rushed for 87 yards and John Brown caught seven passes for 99 yards. He became Buffalo’s first 1,000-yard receiver since 2015.

LATEST PATRIOTS CONTROVERSY COULD BE HUGE IF TEAM FOUND LYING ABOUT INTENTIONS, STEELERS VETERAN SAYS

The Steelers entered with wins in seven of their last eight games since a 1-4 start.

Devlin Hodges completed 23 of 38 passes for 202 yards with one touchdown and four interceptions. Hodges had a chance to become the first undrafted rookie in the Super Bowl era to win his first four starts.

James Conner played for the first time since missing five of the last six games with a shoulder injury. He finished with 42 yards rushing and caught a touchdown pass.

Pittsburgh scored on the first drive of the second half to take a 10-7 lead.

Hodges opened the series with a 31-yard pass to Diontae Johnson and Conner broke off a 17-yard run, setting up his 11-yard touchdown reception two plays later. The 69-yard touchdown drive came after Pittsburgh totaled 64 yards in the first half.

ROBERT KRAFT COMMENTS ON LATEST NEW ENGLAND PATRIOTS FILMING SCANDAL

Tre’Davious White returned his second interception of the game 49 yards to the Pittsburgh 18 late in the third quarter. The Bills couldn’t capitalize with a touchdown and instead settled for a 36-yard field goal by Stephen Hauschka to tie it.

The Bills took a 17-10 lead on their next possession.

Allen connected with Brown for a 40-yard gain one play after a Pittsburgh punt. Five plays later, Allen found Kroft at the front pylon for a 14-yard touchdown pass.

CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM

Allen’s 1-yard touchdown run on the second play of the second quarter opened the scoring.

Allen’s ninth score also established a new single-season franchise record for touchdowns rushing by a quarterback. Buffalo took advantage of a short field following a 22-yard punt and converted a fourth down during the 40-yard series.

Pittsburgh trailed 7-3 when Steven Nelson picked off Allen late in the second quarter. A facemask set Pittsburgh up with first-and-goal from the 10, but Johnson fumbled and the Bills recovered to preserve a four-point halftime lead.