Wyoming led by four with 59 seconds left in regulation until Gray hit a 3-pointer and, after two Jason McManamen free throws, Gray converted a 3-point play with 19 seconds left to force overtime.
Houston (9-2) jumped out to a five-point lead with 1:52 left in the first overtime. Josh Adams hit two free throws and Alexander Aka Gorski made another to pull to 79-77 with 44 seconds left. Adams sent it to a second overtime on a layup with two seconds left.
After the eighth and final tie, Ronnie Johnson and Dotson made layups for a four-point Houston lead. Then Wes VanBeck and Dotson hit 4 of 4 free throws in the final 12 seconds to seal it.
Adams led Wyoming (7-6) with 34 points for his second straight game with 30-plus.