O’Toole joined the Cobblers in the summer of 2014, and has scored 26 goals from midfield in just over 100 starts for the club.
A hugely popular figure with the supporters, O’Toole was named the Player of the Season during the club’s record breaking League 2 title winning season of 2015/16.
“Securing the services of John-Joe is a huge boost for us,” said manager Justin Edinburgh.
“We knew there would be a lot of interest in him so we were very keen to get John-Joe’s future secured early and we are delighted to have done just that.
“Goalscoring midfielders are very hard to come by and John-Joe won us some big matches this season with some very important goals.
“His all round game was also very impressive and I have delighted with his attitude and commitment to the club.
“We have re-signed a player at an excellent age and this is fantastic business to start our summer work.”
With his future resolved, O’Toole underwent surgery this week to resolve his groin injury that hampered him in the final weeks of the season.
“Once John-Joe’s future was resolved, and our safety was secured, it made sense to get his surgery done now to give him the maximum recovery time so he is fully fit for pre-season,” said Edinburgh.
“The surgery went well and he is now recovering before he steps up his work as we get closer to pre-season.”