The 39-year-old has put pen to paper on a new contract after pushing the club into a concrete mid-table position in League Two following his appointment in November.
"I'm really, really pleased," Ainsworth told the club's official website. "I'm honoured, proud and very, very thankful to everyone that has supported me in any way that they have.
"This is enormous for me and I'm really thankful to everyone who has helped me achieve this. I want to repay the Trust and all the supporters by working so hard and bringing back the glory years. I'll give it my best shot, I promise you."
Joint-chairman Don Woodward added: "It's great to secure Gareth's services and we are really looking forward to continuing to work with a young but passionate manager.
"He's been fantastic at getting the best out of players and if we can keep that going and he can keep learning, he should follow in the footsteps that most Wycombe managers have done by progressing his career and taking us along for the ride.
Ainsworth has also confirmed that this Saturday's match against Port Vale will be his final game as a professional footballer.