Williams, 28, was the NBA's Sixth Man of the Year last season after averaging a career-high 15.5 points with 2.1 assists and 1.1 steals in 80 games for the Toronto Raptors. In 10 NBA seasons with the Philadelphia 76ers, Atlanta Hawks and Raptors, Williams has averaged 11.9 points while making 34.1 percent of his 3-point attempts.
Williams' agent Wallace Prather completed the deal with Lakers general manager Mitch Kupchak on Sunday.
As constituted, Williams would join Kobe Bryant, D'Angelo Russell, Jordan Clarkson and Nick Young in the Lakers' guard rotation.
Williams' agreement comes one day after the Lakers negotiated a trade to acquire center Roy Hibbert from the Indiana Pacers.