BOISE, Idaho (AP)Puka Nacua caught 14 passes for 157 yards and two touchdowns, including an acrobatic catch for the go-ahead score with 1:46 remaining, Jaren Hall passed for 377 yards and BYU defeated Boise State 31-28 on Saturday night.

BYU (5-5) snapped a four-game losing streak in the final match-up of a 12-game series with neighboring Boise State. It was only the second time the Cougars won on the Broncos’ famed blue turf.

”We wanted to get our run game established to give us some room to work on our play-action passes,” BYU coach Kalani Sitake said. ”I think we’re able to stay balanced. Their defense has been fantastic. We knew that it was going to be a struggle and there’d be some tough sledding, but we just keep sticking with it.”

BYU didn’t seem to struggle much, except in the first half when the Cougars got inside the Boise State 25 where they committed two turnovers and had one turnover on downs.

Boise State (6-3) saw its four-game winning streak snapped as the Broncos’ nationally second-ranked defense surrendered 532 yards, a season high.

”We’re still in position to accomplish our goals,” Boise State coach Andy Avalos said. ”We set out to protect the Blue tonight, but we didn’t get it done. But we can learn a lot from it.”

It seemed like the Broncos were learning how to win a tight game after trailing late. But BYU had other ideas.

Trailing 28-24 with 6:28 remaining, Hall cobbled together a nine-play, 75-yard drive that ended when Nacua made a juggling 6-yard touchdown reception on fourth down. He out-jumped Boise State cornerback Caleb Biggers, twisted in the air while securing control of the ball, and then tapped his feet down.

”It wasn’t the best look to throw that ball,” said Nacua, whose 14 catches tied him for the third most in a single game in school history. ”But Jaren threw it up to me. That’s my job to go out there and make plays, and I came down with it.”

BYU dominated the first half on the stat sheet, but not the scoreboard as the half finished with the score knotted at 7.

The Cougars passed up a chip-shot field goal on fourth-and-goal from the half-foot line with one second remaining in the half. But after four combined timeouts in a game of cat-and-mouse, Lopini Katoa’s dive off right tackle was stuffed by Boise State’s Ezekiel Noa at the goal line.

But that was a decision Sitake won’t be scrutinized for too much after the Cougars escaped with a victory.

Boise State, which mustered only 76 yards of offense in the first half, found its rhythm in the second half and turned the game into a see-saw affair. There were six lead changes in the second half as neither defense had much of an answer for the offensive explosion.

Boise State quarterback Taylen Green was 17 of 23 for 220 yards and two touchdowns. George Holani added 75 yards on the ground.

THE TAKEAWAY

BYU: During the Cougars’ four-game losing streak, their defense struggled, giving up over 400 yards in every loss and over 500 yards twice. But the Cougars answered the bell, holding Boise State to under 400 yards with 324, a feat they hadn’t accomplished since their last win, a 38-26 victory over Utah State.

Boise State: The Broncos fledgling hopes of playing in a New Year’s Six game vanished with the loss, but they remain in control of their fate in the Mountain West. If Boise State wins its final three conference games, it will host the Mountain West title game, a notion nearly unthinkable at the end of September after losing 27-10 to UTEP.

UP NEXT:

Boise State: The Broncos travel to Nevada on Saturday.

BYU: The Cougars have a bye week before hosting Utah Tech in the Cougars’ home finale.

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