Efe Abogidi scored five points, Aljaz Kunc added a bucket and Williams scored the game's final points on a floater as Washington State (14-10, 7-10 Pac-12) blanked Stanford 9-0 in the final overtime.
Abogidi finished with 14 points and Kunc and Andrej Jakimovski 11 each with Jakimovski adding nine assists and Dishon Jackson 10 rebounds.
The Cougars were outshot 52% to 36% but had 12 more rebounds, six more 3-pointers and made 18 of 23 at the line to Stanford's 9 of 18. They ended a nine-game losing streak to Stanford (14-9, 10-7) and dealt a blow to the on-the-bubble Cardinal's NCAA Tournament hopes.