The highly-rated 22-year-old was a key man as the Gills won promotion back to League One at the first attempt after arriving from Spurs - initially on loan - in September last year.
He made his move a permanent one on a short-term deal until the end of last season in the January transfer window and Barcham - who can play on the wing or as a striker - has now penned a
contract to stay at Gills until June 2011.
Manager Mark Stimson said: "Andy came to the club last year and helped us achieve what we set out to do. To get him on a two-year deal is a major plus.
"There was a fair bit of competition to get his signature but we've beaten the other clubs to it.
"Andy is young and hungry and he puts everything into training and matches. It's a fantastic signing for Gillingham."