Stefan Nastic and Chasson Randle helped Stanford score 13 of the final 15 points, only to see the rally fall short in a 79-77 nonconference men's basketball loss at host BYU on Saturday night in Provo, Utah.
The Cardinal (6-3) recovered from double-digit deficits in both halves and had two chance to win or tie the game in the final six seconds.
The Cougars took a 77-64 advantage with 3:41 remaining to play before Nastic and Randle combined for nine of the final 13 points to give Stanford a chance.
Anthony Brown scored the other four points during the run.
The Cardinal, 1-3 away from Maples Pavilion, travel to No. 9 Texas for a game on Tuesday at 4 p.m. (ESPN2).
Randle scored 24 points to lead the Cardinal, which had won three of its previous four games. He has 1,821 career points.
Already third on the school's all-time list, he could join former NBA players Todd Lichti and Adam Keefe as the only players to reach the 2,000-point mark.
Randle continues to work his way up Stanford's all-time lists in several categories. He moved past Howard Wright and into fifth all-time with 596 made baskets.
After a 4 of 7 effort from long range, Randle has 234 for his career, seven shy of Dion Cross' school record 241.
Nastic may have taken a step in becoming a dominant presence in the paint after scoring 20 points and grabbing a team-best nine rebounds.
Freshman Reid Travis added 15 points and six rebounds for Stanford.