Williams's deal is worth $3.2 million, including a $1 million signing bonus and another $1 million guaranteed, a league source told ESPN NFL Insider Adam Schefter.
San Francisco signed Williams as an undrafted free agent out of Notre Dame in July 2011. He has seven tackles in four games over the past two seasons.
The 23-year-old Williams is a native of Altamonte Springs, Fla. He had 161 tackles, two interceptions and 1½ sacks in 45 games for the Fighting Irish.
Information from ESPN NFL Insider Adam Schefter and The Associated Press was used in this report.