RENO, Nev. (AP) Brett Rypien threw for 299 yards and two touchdowns as Boise State held on for a 31-27 win over Nevada on Saturday night.

The contest included four lead changes in the first half, and both teams scored on their first two possessions of the second half before the Broncos (4-2, 2-1 Mountain West) pulled away with a 17-play, eight minute, 20 second drive in the fourth quarter.

Nevada's Ty Gangi completed 24 of 42 passes for 304 yards and 2 touchdowns after missing last week's game against Fresno State with a thigh contusion.

Rypien threw three interceptions. Gangi threw one, but it was a big one that ended a second-quarter Wolf Pack drive as Tyler Horton picked off the pass and returned it 99 yards for a touchdown.

Boise State's Haden Hoggarth made a 31-yard field goal as time expired in the second quarter to make it 17-all going into the break.

Boise State took a 31-24 lead with 5:37 left in the third quarter on a 41-yard pass from Rypien to A.J. Richardson.

Nevada (3-4, 1-2) answered on the next possession with a 28-yard Ramiz Ahmed field goal to pull within four.

But after the back-and-forth first three quarters, Boise State kept the ball out of Gangi's hands with the Broncos' final drive of the game that went more than eight minutes and left Nevada with only six seconds left from its own 24.

THE TAKEAWAY

BOISE STATE: The Broncos got back on track after last week's 19-13 loss at home against San Diego State.

NEVADA: After missing last week with a thigh contusion, quarterback Ty Gangi appeared limping on several plays, but passed for 304 yards and two touchdowns.

UP NEXT

BOISE STATE: The Broncos return home to play Colorado State.

NEVADA: The Wolf Pack travels to Hawaii.

LOPSIDED RIVALRY: The Boise State-Nevada rivalry goes back five decades and spans four conferences. With Boise State's win Saturday, the Broncos pushed their overall record against Nevada to 30-13. Boise State has one 16 of the last 17 in the series.

RECORD RUN: Boise State wide receiver John Hightower's 88-yard touchdown run got the Broncos on the board in the first quarter and tied for the longest play from scrimmage in Boise State history. Former Broncos running back Jeremy McNichols ran for 88 yards in 2015.

RUFUS RETURN: Nevada safety Asauni Rufus suffered a season-ending injury (broken tibia) at Boise State last year. After three surgeries, the senior has returned to play this season and passed Brock Marion against Boise State on Saturday for fourth on Nevada's career tackles list (310).

Copyright 2018 by AP. Any commercial use or distribution without the express written consent of AP is strictly prohibited.