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.
Adams led Wyoming (7-6) with 34 points for his second straight game with 30-plus.