Both teams will play in the Big 12 tournament this week in Oklahoma City.
The Longhorns (34-19, 15-12) broke a 3-3 tie in the eighth inning with an unearned run off Kyle Thebeau (5-4). Leadoff hitter Michael Torres doubled, took third on an error by center fielder Kyle Colligan and scored on Travis Tucker's sacrifice fly.
Moldenhauer gave Texas some breathing room with his first homer of the season in the ninth.
Cole Green (3-4) pitched 2 2/3 scoreless innings of relief for the win. Texas starter Kenn Kasparek had a 24-inning scoreless streak snapped on a third-inning RBI double from Colligan, who also homered. Kasparek allowed five hits and three runs and struck out six in 6 1/3 innings.