Stanford, Calif. • BYU didn’t react well to the experimental rule changes in NIT games on Wednesday night — especially the one about having to play in the third quarter.

Stanford doubled up the visitors in that quarter, outscoring BYU by 13 in the period after the Cougars led by four at halftime. The Cardinal held off a furious BYU comeback after coach Dave Rose was assessed a technical foul to take an 86-83 win at Maples Pavilion.

Trailing by nine with less than a minute remaining, the Cougars rallied and cut the deficit to 85-83 when Elijah Bryant hit a 3-pointer with less than 10 seconds remaining. After Stanford’s Daejon Davis made a free throw, Bryant was purposefully fouled with 5.7 seconds left.

He missed the first free throw and intentionally missed the second. The Cougars got the rebound and a good look from TJ Haws, but couldn’t convert and the Cardinal moved on.

“We did well, I felt like,” BYU’s guard Jahshire Hardnett told the BYU Sports Network. “There were just some things we wish we could go back and change.”

Bryant finished with a game-high 28 points, but was 3 of 8 from the free-throw line. Stanford was 19 of 32 from the charity stripe to let its big lead slip away, but used a 47-37 rebounding advantage and the big third quarter to escape with the win.

Yoeli Childs added 11 points and 10 rebounds before fouling out with 2:27 remaining for BYU. Hardnett scored 12 points before also fouling out as the Cougars were whistled for 24 fouls to Stanford’s 15.

“Their size and length and ability to guard us was difficult to overcome,” Hardnett said.

The Cougars finished the season at 24-11 while losing in the NIT’s first round for the second straight season. Stanford improved to 19-15.

The Cougars took their biggest lead, 39-30, when seldom-used freshman Rylan Bergersen followed a 3-pointer with a pair of free throws in the second quarter. Bergersen scored a career-high seven points.

Stanford scored the final five points of the first half and the first seven points of the third quarter to take a lead that it would not relinquish.

The Cardinal pushed their run to 31-13 — eerily similar to the run Gonzaga went on against BYU to win the WCC championship — by outscoring the Cougars 26-13 in the third quarter and entered the fourth with a 61-52 lead when Oscar Da Silva banked in a 3-pointer. It was that kind of quarter for BYU.

Two-time all-Pac 12 performer Reid Travis led Stanford with 25 and four other Cardinal players reached double figures.

Stanford went up 72-58 with the free throws after Rose’s technical, but BYU went on a 10-0 run to get back in it.

BYU played without sixth-man Dalton Nixon, who injured his shoulder in the WCC championship game and underwent surgery Tuesday. Payton Dastrup was the first player off the bench, and delivered a two-hand slam in the first quarter.

However, Dastrup was inadvertently smacked in the face by teammate Luke Worthington in the second quarter and left the game with a bloody chin that required eight stitches to close. He finished with nine points.