PROVO — All week, BYU coach Bronco Mendenhall was telling his players, and the media, that nothing would come easy for his team this season.

The Cougars proved him right Saturday, again and again.

Mendenhall expected the game against Wyoming to be similar to the San Diego State contest, which finished 24-21 for BYU. This time, Cougars beat the Cowboys in a nail-biter, 25-20, at LaVell Edwards Stadium.

And for BYU (3-5, 2-2) these days, no victory is taken lightly.

"Both teams were similar coming in and there were execution flaws on both sides that kept the game close," said Mendenhall afterwards. "We had a number of chances to pull away. But mistakes here or there kept it close. But I liked the resiliency of our team and I liked the end result."

Though the Cougar defense dominated most of the game, due to a couple of big mistakes by the offense, it took a defensive stand in the waning moments to preserve the win. Even when BYU comes out on top, it's always in dramatic fashion.

"That's just where we currently are," Mendenhall said. "Until our execution, until our position mastery, until our confidence, and until a volume of games and plays starts to add up, it will be like that. I told our team earlier this week that I anticipated this game to be very similar to San Diego State, where someone would have to be on the field to win the game. Sure enough, it ended up just like that."

BYU scored more points in a single game than it had all season and sent Wyoming (2-6, 0-4) home with its third consecutive loss.

The Cougars jumped out to a big lead early. Cody Hoffman returned the opening kickoff 34 yards to the Wyoming 42, then the offense drove 58 yards for a score, capped by a seven-yard touchdown run by JJ Di Luigi.

On the Cowboys' opening possession, a bad snap sailed over the head of quarterback Austyn Carta-Samuels and into the end zone. Carta-Samuels kicked the ball out of the end zone for a safety to give the Cougars a 9-0 advantage five minutes into the game.

BYU punched in another touchdown minutes later on a four-yard run by Bryan Kariya to go up 16-0.

But the Cougars squandered that big lead as a pair of turnovers changed the complexion of the game. First, Wyoming linebacker Keith Lewis intercepted Jake Heaps' underthrown pass out in the flat and he returned it 55 yards for a touchdown to put Wyoming on the board, 16-7.

On the Cougars' next drive, running back Joshua Quezada fumbled and Marcell Gipson recovered at the BYU 20. Ian Watts drilled a 44-yard field goal to make it 16-10 at halftime.

At that point, the Cowboys had minus-18 yards of total offense, compared to 178 yards for BYU, but they trailed by just six.

The two teams traded field goals in the third quarter, then Heaps connected with Luke Ashworth for a 12-yard touchdown pass early in the fourth to put the Cougars up 25-13.

After a Wyoming punt that hit a Cowboy player in the back gave BYU the ball at the Wyoming 24, it appeared the Cougars had the victory safely sealed.

But BYU, which seems to love living on the edge, failed to score on the drive, which ended in a blocked field goal attempt.

Wyoming then scored in lightning-quick fashion, going 80 yards in 1:20 that culminated with a 16-yard touchdown pass from Carta-Samuels to Chris McNeill to make it 25-20 for BYU with 6:50 remaining in the game.

The Cowboys stopped the Cougars, then drove again into BYU territory, all the way to the 25-yard line.

"It was hard to be patient as a play-caller in that situation, especially with a mobile quarterback," Mendenhall said. "But we dropped eight a lot of times. Our secondary hung tough. With only three guys (rushing), it was hard to keep him in the pocket."

On the final play, fourth-and-10, "we did rush four and had a twist," Mendenhall explained. "(Freshman linebacker) Kyle Van Noy knocked the ball down and that was my hope, to fill a pass-rush lane and make him to throw it a little bit quicker than what he had been doing. They executed exactly what they were supposed to."

Only then could Cougar Nation take a sigh of relief.

"We were excited for the chance to be out there," linebacker Shane Hunter said of the final defensive stand. "We love it when it comes down to us being out there and having to get the win. Wyoming's a great team and it was a great opportunity for us to rise to."

BYU has a bye next week. The Cougars play again on Nov. 6, in Provo, against UNLV.