Knott made 24 appearances for the Gills last season after joining from Bradford in June 2016, but was placed on the transfer list in May.
The 24-year-old ended last season on loan with Lincoln, helping them win promotion from the National League.
"We had a great end to last season and it was only right to come back here," he told Lincoln's club website.
Find all the latest football transfers on our dedicated page.
Lincoln City have signed midfielder Billy Knott on a one-year deal following his release by Gillingham.