The 24-year-old has been a key figure for the club since signing from Alfreton Town in 2016.
Last year's National League North Player of the Year, Leesley was an integral cog to Town's promotion winning side.
The former England C international has more than coped with the step-up to the National League, prompting the club to secure his future.
Manager Simon Weaver said it was imperative that the club keep a hold of their biggest talents.
“I think it is deserved. Joe has stepped up a level in terms of his performance this year and has done so at a new level in The National League," Weaver told the club's website.
“We get a lot from Joe on the pitch, and off the pitch he’s a great character who we are delighted to have secured for the long term.
“We want to create a sense of belonging at the club and this shows how far the club has come in that we are now able to secure the future of players who we see here for the long term.”
“We are confident in our judgement and that this can be a platform for Joe to continue his success at this club.”