Williams had 29, made all of his 10 attempts from the foul line and dealt out 12 assists. Brooklyn has moved to the brink of clinching a home-court edge in the opening round of the playoffs.
Lopez added 21 points and Johnson had 20. Brooklyn went 25-of-28 from the free throw line.
Paul Pierce led Boston with 23 points. The Celtics lost their second in a row and are nearing a seventh-place finish in the Eastern Conference, which would set up a likely first-round playoff meeting with New York.