The actor - who plays Danny Pennant - has already filmed his final scenes, which will air next month.
An 'EastEnders' spokesperson confirmed the news to Digital Spy, saying: "We can confirm that Gary is leaving EastEnders later this year and we wish him all the best for the future."
Gary - who has been a regular in Albert Square since September 2012 - took to Twitter to thank fans for their support - and hinted he may return to the soap in the future.
He tweeted: "Thank you for your messages loved my time @Ee interesting character with lots of scope see u later rather than good bye ;-) ps more 2 come x"
Earlier this month, the actor spoke out following negative comments on Twitter about his on-screen kiss with newcomer Johnny Carter (Sam Strike).
"Reaction was, on the most part, positive. There were a few on Twitter still living in the dark ages but on the whole, people were okay," he said.
"I got one message on the internet from a guy saying, 'Thanks for that storyline because it gave me the courage to come out and tell my parents'. If you can do that, you as an actor and the show has done its job."
Suggested For You
SUBSCRIBE AND FOLLOW
Get top stories and blog posts emailed to me each day. Newsletters may offer personalized content or advertisements.Learn more