Jaiden Delaire scored 11 points off the bench, including a key 3-pointer with a minute to play, giving the Cardinal (19-9, 8-7 Pac-12) a six-point lead.
Gach hit a layup with 3 minutes remaining as the Utes cut the Cardinal lead to 63-60.
Utah had three chances to tie the score but missed two 3-pointers and committed a turnover.
Brenchley scored in double figures for the third time and his first since December 7. Gach was in double figures for the first time in 10 games and Carlson reached double figures a fifth straight game.
A 14-2 run spanning both halves brought the Utes within 36-30 early in the second half.
Terry hit a pair of 3-pointers and another basket to help the Cardinal open a 50-37 edge midway through the second half.
Stanford opened a 34-16 lead with 4:18 left in the first half but then went scoreless the rest of the way as Utah pulled within 34-22 at halftime.
Utah: With the loss, the Utes can finish no higher than eighth, which means a tough road ahead in the conference tournament. While the NCAA seems out of reach, Utah can still play in a postseason tournament but will need a win or two to solidify its resume.
Stanford: Spencer Jones hit a pair of 3-pointers and has 74 on the season, matching Casey Jacobsen for the second-most 3s by a freshman. … Terry set a season-high for 3-pointers with seven.
Utah: The Utes travel to California on Saturday.
Stanford: The Cardinal host Colorado on Sunday.