The 34-year-old made his debut in 2014 and played 64 Test matches.
Moeen made his Test debut in 2014 against Sri Lanka and went on to represent England 64 times.
He took 195 wickets, including five five-wicket hauls and a hat-trick against South Africa in 2017, and scored five centuries.
He said: “I’m 34 now and I want to play for as long as I can and I just want to enjoy my cricket.
“Test cricket is amazing, when you’re having a good day it’s better than any other format by far, it’s more rewarding and you feel like you’ve really earned it.
“I will miss just walking out there with the lads, playing against the best in the world with that feeling of nerves but also, from a bowling point of view, knowing with my best ball I could get anyone out.
“I’ve enjoyed Test cricket but that intensity can be too much sometimes and I feel like I’ve done enough of it and I’m happy and content with how I’ve done.”
Moeen lost his central contract in 2019, which led him to focus on franchise cricket.
Moeen thanked his coaches, captains and family for the support given throughout his career.
He added: “I have to thank Peter Moores and Chris Silverwood for being my coaches and Peter for giving me my debut. Cookie (Alastair Cook) and Rooty (Joe Root) as the captains who I’ve enjoyed playing under, and I hope they are happy with how I played.
“My parents are my number one, I feel without their support there is no way I would have made it, every game I played was for them and I know they are really proud of me.
“My brothers and my sister, on my bad days they’ve been the first to pick me up, and my wife and kids. My wife’s sacrifices and the patience she has, I am really grateful for that. They have all been amazing on my journey. Everything I did, I did for them.”
Moeen is also hoping his career can inspire other English Muslims to aspire to play Test cricket.
“It always takes somebody to inspire you or takes somebody to think, if he can do it, I can, and I hope there are a few people out there who are thinking that,” he said.
“I know he wasn’t English but someone like Hashim Amla when I first saw him, I thought if he can do it I can do it, it does take that little spark.
“I’d love one day in 8-10 years’ time to say Moeen made it easier for me. There have been guys before me who made it easier, so you hope to open the door for someone else.”