Texas reeled in the Owls by making five of its next 10 attempts from the floor and Cameron Ridley's dunk made it 22-22 at the 4:11 mark.
The lead changed three times in the first 10 minutes of the second half until McClellan dunked to give Texas the lead for good at 34-33.
"We knew what we were doing wrong and what we had to do to take the lead and finish the game," Texas guard Javan Felix said.
Rice hung on and got back within two points when it cut its deficit to 38-36 on a 3-pointer from Julian DeBose.
"I thought we battled pretty hard," Rice head coach Ben Braun said. "We missed some opportunities."
Jaylen Bond made his first appearance for Texas since leaving a game Nov. 19 with a left foot injury. He scored three points and grabbed six rebounds in 12 minutes of action.
Texas won its 350th game under Barnes, who is now 350-142 at UT since coming from Providence prior to the 1999 season.
16 Week Curriculum With Instructions, Lesson Plans & CNG Conversion Kit