LEXINGTON, Ky. (AP)Otherwise under siege in the pocket, Will Levis got just enough protection to make big throws when No. 8 Kentucky needed them.

The quarterback tied a career best with four touchdown passes, including critical scores of 70 and 40 yards to Barion Brown and Tayvion Robinson, after halftime, and the Wildcats held off Northern Illinois 31-23 on Saturday night.

After allowing the pesky Huskies a tying touchdown seconds before halftime, Levis put the Wildcats (4-0) ahead 21-14 just 58 seconds into the third quarter by hitting Brown across the middle on third and 10. Coming a snap after the senior quarterback was nearly intercepted, it was just what Kentucky needed to gain room from a NIU squad unfazed by being 26-point underdogs.

Matt Ruffolo’s 49-yard field goal later in the third provided a 10-point cushion and came during a hot stretch in which Levis completed eight consecutive attempts. Levis later found Tayvion Robinson, who spun off a tackle and ran 40 yards for his second TD to make it 31-17 with 8:46 remaining.

That cushion helped as the Huskies fought back to within 31-23 with 2:47 left on Justin Lynch’s 2-yard run after a defensive holding penalty. Ethan Hampton’s two-point conversion pass failed, Kentucky recovered the onside kick and Levis knelt to seal the win.

”Overall, just a sluggish game,” Kentucky coach Mark Stoops said. ”Good to get it behind us. We know that’s a good football team that’s tough, they’re gonna play hard and compete for their conference championship. We knew it wasn’t going to be easy and I thought we did some good things.”

Levis overcame five sacks to complete 18 of 26 passes for 303 yards, his third 300-yard effort this season, with chunk plays comprising each TD. Robinson (seven catches, 147 yards) also had a 69-yard score on a crossing pass just as Levis was a second away from a crushing sack. Brown caught four passes for 102 yards and two scores, including a 15-yarder on Kentucky’s first possession.

But for Levis, the obvious key to success was being allowed to create good things with big-play receivers.

”Two of the three (touchdowns), I had time,” he said. ”The first one was soft protection, after that they brought pressure. Tayvion had the ability to make moves and Barion has next-level speed.”

NIU (1-3) drove 75 yards on the opening possession for Hampton’s 2-yard TD pass to Tristan Tewes, who also snagged a 3-yard score from Shemar Thornton six seconds before halftime. The Huskies made it a one-score game late but lost their third in a row and second in as many weeks to a Southeastern Conference school.

”I thought we had every opportunity to go out there and win the football game,” NIU coach Thomas Hammock said. ”We just have to continue to fight to get 11 guys doing their job every play, because you change three plays from that game and it takes 21 points off the board (for Kentucky).”

THE TAKEAWAY

Northern Illinois: Like last week against Vanderbilt, the Huskies started fast and forced the Wildcats to counterpunch before shocking them with a wideout pass in the second quarter. They harassed Levis early and often but couldn’t slow his receivers who broke coverage to get open for big-play TDs.

Kentucky: Pass protection remains a concern after again allowing multiple sacks of Levis, whose rollouts bought time to hit big passes later in the game. The Wildcats still have things to correct before visiting Mississippi next week. The good news is leading rusher Chris Rodriguez Jr. returns next week from a four-game suspension, which should help the ground game provide balance.

QUARTERBACK COMMITTEE

A week after relieving an injured Rocky Lombardi, NIU freshman Ethan Hampton started this week and completed 13 of 25 passes for 196 yards. Justin Lynch also lined up behind center but rushed seven times for 21 yards including the late TD that got the Huskies within eight. Thornton made the most of his lone pass, taking a handoff and rolling right before hitting a wide-open Tewes for a score.

ODDS AND ENDS

Just two drives consumed much of the first quarter with each team marching 75 yards. NIU had 11 snaps for 6:07, Kentucky used 16 plays and 8:01. … Kentucky won its 19th consecutive nonconference game, the longest active in FBS. … The Huskies had six tackles for loss and out-rushed the Wildcats 128-103.

POLL IMPLICATIONS

Kentucky won but might drop after having to work harder for this victory as a heavy favorite.

UP NEXT

Northern Illinois opens MAC play at Ball State on Saturday.

Kentucky resumes SEC play at No. 16 Mississippi on Saturday.

More AP college football: https://apnews.com/hub/college-football and https://twitter.com/AP-Top25. Sign up for the AP’s college football newsletter: https://apnews.com/cfbtop25