Allen's previous high was 14 points against Oregon on March 1. He made 10 of 12 shots from the field against UC Davis.
"I was ready to play from the start," Allen said. "I want to win this tournament."
Corey Hawkins, the Big West Player of the Year, scored a season-high 34 points on 12-of-22 shooting for UC Davis (25-7), which played its first NCAA Division I postseason game in school history. Hawkins played his final game for the Aggies.
"I don't know if it's set in yet," Hawkins said. "I couldn't have imagined a more bittersweet way to go out, and I felt like I owed my teammates to play absolutely as hard as I could. They deserve all the props because without them my performances and my awards wouldn't have been possible. It's sad, but hopefully we've raised the bar for this program."
Stanford (20-13) opened the second half on a 20-6 run, extending its lead to 57-42 with 11:50 left to play. Allen ignited the run with three straight baskets to open the half, two layups and a jump shot.
"I think my teammates spread the floor more for me," Allen said. "I was able to find lanes."
Hawkins scored 21 points on 7-for-10 shooting in the first half, but Stanford led 37-36 at the break. Randle and Allen each scored eight first-half points for the Cardinal.
Stanford led 30-19 with under six minutes left in the first half, but the Aggies went on an 11-0 run and pulled even with 3:30 left. UC Davis, which entered the game shooting a sizzling 45.0 percent from long range, missed its first five 3-point shots before Hawkins connected from beyond the arc with under five minutes left in the half. Hawkins made two 3-pointers and Tyler Less one during the Aggies' run.
For the game, Stanford held UC Davis to 37.3 percent shooting from 3-point range.
"We really tried to concentrate on taking the 3s away as best we could," Stanford coach Johnny Dawkins said.
UC Davis: After going 9-22 last season, the Aggies finished 25-7 this year and won the Big West's regular-season title with a 14-2 mark.
"This group put UC Davis basketball on the map," Aggies coach Jim Les said. "A lot of people said it couldn't be done, but this group, especially our seniors, brought hard work, great competitiveness. ... They've set a standard we're going to try to live up to."
Stanford: The NIT is using a 30-second shot clock, instead of the regular 35, for the 2015 tournament. "I think it's good," Stanford coach Johnny Dawkins. "I like it at 30. Who knows what we're going to do, but I'm glad we're experimenting with it. It makes sense."
UC Davis' season is over.
Stanford will play Rhode Island in the second round.