James dropped in a couple of free throws with 1:42 to play to halt a 7-0 run by the Cowboys, who had pulled to within seven points, and Texas held for its third win in four games.
Dexter Pittman registered 16 points and Jordan Hamilton had 13 for the Longhorns (22-6, 8-5 Big 12).
James Anderson and Obi Muonelo each scored 14 points for Oklahoma State (19-8, 7-6).
Megyn Kelly: Santa Claus and Jesus are both white men
Costly malfunction causes beer flood at Boston-area brewery