He was available after being released by Truro, with whom he won promotion out of Chesham's division in 2014-15.
It extends Hayles' 26-year career, which has taken in teams including Leicester, Cheltenham and Arlesey Town.
"He is incredibly fit, and still loves the game," Chesham boss Andy Leese told the club website.
"He has a lot to offer on the pitch still and now off it as well as he looks to start a coaching career."
Find all the latest football transfers on our dedicated page.
Former Fulham and Stevenage striker Barry Hayles has joined Southern League Premier Division side Chesham United as a player-coach at the age of 43.