The Nets had only a one-point lead after Ben Gordon hit a 3-pointer for the Bobcats with 2:44 to play, but Brooklyn dominated the rest of the way.
Williams hit a jumper and six free throws down the stretch, finishing with 32 points and six assists.
Brook Lopez added 19 points and four blocks for the Nets while Andray Blatche had 16 points.
Charlotte lost its second in a row as it tries to avoid owning the worst record in the NBA this season. The Bobcats have one fewer victory than does Orlando.
Gordon paced Charlotte with 27 points off the bench.