The Jayhawks were holding only a three-point lead with 9 minutes to play when they ran off their eight consecutive points.
Kansas held on from there to win for the fifth straight time and boost its record to 6-1.
Ben McLemore led the way for Kansas with 21 points and Travis Releford had 20 to go with seven rebounds and five assists. Withey finished with 17 points.
Ahmad Stars hit seven 3-pointers and scored 25 points for the Beavers (4-2), who had won their previous two games.