The 19-year-old academy product becomes the third young player to commit their future to Paul Buckle's Robins, following Omari Sterling-James and Zack Kotwica, who both signed up last week.
Former St Peter's School pupil Hanks has started the last two matches alongside Matt Richards in the centre of the pitch.
He announced his arrival on the first team scene with a spectacular strike at Bury on the opening day of the season, having replaced the injured Asa Hall early on.
He also netted in the 1-1 home draw with Dagenham and Redbridge in September, cancelling out Jamie Cureton's opener.
Hanks, who has spent time on loan at Bishop's Cleeve and Gloucester City, has made a total of 14 starts and 11 substitute appearances for Cheltenham.