The deal is worth $10.5 million deal, according to multiple reports.
"We are very excited to be able to keep a player and teammate like Jeremy in red and gold," 49ers general manager John Lynch said in a statement. "As we evaluated the roster, his production on the field really impressed us and we believe he is a great fit for our scheme. As we learned more and more about him, it became obvious his teammates have a great deal of respect for Jeremy as well. He is a true pro who is an asset to this team on offense, special teams and in the locker room."
In 2016, the 5-foot-9, 188-pound Kerley appeared in all 16 games (13 starts) for San Francisco and led the team with a career-high 64 receptions for 667 yards and three touchdowns. He also returned 21 punts for 158 yards as the team's primary punt returner.
In five seasons with the Jets (2011-15), Kerley played in 74 games (24 starts) and recorded 182 receptions for 2,225 yards and nine touchdowns. He led the Jets in total receptions and receiving yards during his time with the team. Kerley has also returned 134 punts for 1,250 yards and one touchdown. In 2015, he registered a career-high 411 punt return yards, which ranked second in the NFL.
Kerley signed with the Lions last March following his release from the Jets.