Luton Town have agreed a deal to sign Garry Richards on a two-year deal from 1 July.
The 26-year old, who made made 122 appearance in four years at the Priestfield Stadium, has also had spells at Colchester and Southend.
Hatters boss Paul Buckle said: "I'm after winners, and Garry is a winner."
Buckle continued: "With both Colchester and Gillingham he has had the experience of winning promotion.
"He's a leader too, and has a real presence in defence. He is strong and powerful."