The Los Angeles Lakers have agreed to a three-year, $21 million contract with free-agent guard Lou Williams, sources told ESPN.com.

News of the deal, which cannot become official until Thursday, was first reported by Real GM.

Williams played last season with the Toronto Raptors and enjoyed a career year. He averaged a career-best 15.5 points in 80 games to win Sixth Man of the Year honors.

"You can't leave him open," Toronto general manager Masai Ujiri said at the end of the regular season. "Sometimes the percentages don't really kind of show exactly what the impact is, but we knew what kind of impact Lou would have. He has helped us win games and helped a lot of players open up."

Williams wasn't sure whether he would be the same player after tearing his ACL in January 2013. But after being traded by the Atlanta Hawks to Toronto last summer, Williams was a key component to the Raptors' run to the Atlantic Division title and the East's fourth-best record (49-33).

Lou Williams received 78 of a possible 130 first-place votes for the NBA's Sixth Man of the Year award. Tom Szczerbowski/USA TODAY Sports

Williams led or tied for the Raptors' lead in scoring in 18 games, second most for a reserve in the league. In March, he set a record for points in a quarter with 21 against the Cavaliers in the fourth quarter.

He also became a fan favorite in Toronto in just one season and even was referenced in a song called "6 Man" by Raptors team ambassador Drake.

"He finished a lot of games for us and helped us win a lot of games," Raptors teammate DeMar DeRozan said. "He's a cool dude. Lou Will is the coolest dude in the world. If you can't tell on the court, now you know. He had a song about him and now he's got an award to go with the song."

ESPN.com's Ramona Shelburne and Ohm Youngmisuk contributed to this report