The youth-team product signed his first professional contract last year, and alongside a short loan spell at Conference South side Farnborough, has featured on the O’s bench on a number of occasions this season following injuries to both Adam Legzdins and Gary Woods.
And the 18-year-old, who has been with the O’s for the last five years, is delighted to extend his stay with the club.
“It’s been a long time coming and I am happy to have put pen to paper,” said Grainger.
“I have been here five years now and with this contract it will take me to seven. It’s a homely club and it’s only round the corner for me.
“I have got no complaints about being at this club. I am happy here and I want the team to do well.”
The England under-18 international has enjoyed working with both Woods and Legzdins, and is confident with a further loan spell this season, he can push the duo for a first-team place in the future.
“Adam and Gary have been great and are always there to help you out on and off the pitch,” he added. “They have both been very good to myself and it’s been nice to work with them.
“It’s nice to learn different things off both goalkeepers. They have both played at a very high level and have plenty of experience so that is another thing that will help me push on.
“I need to get myself back out on loan to get some more experience and hopefully next season I can really push on.
“Gary and Adam will be in front of me, but I want to fight for a place and prove I am good enough to play here.”