John Green added 15 points for UCSB (15-12, 8-5).
Williams, who also had four assists, two steals and four blocked shots, moved into fifth on the school's career scoring list with 1,616. He now has 12 double-doubles this season, despite missing seven games due to a shoulder injury.
Two free throws and a jumper by Fox pulled Davis within four with 9:50 left but, following a technical foul, Zalmico Harmon hit a pair from the stripe and Williams made a jumper and UCSB led 57-49 eight minutes to go.
Davis cut its deficit to six twice before a 9-2 run by the Gauchos put the game away.