The 34-year-old, who made 64 Test appearances after making his debut in 2014, leaves the game’s longest format with 2,916 runs and 195 wickets.
Moeen, who is part of England’s squad for the T20 World Cup later this month, intends to continue playing limited-overs cricket at both international and domestic level.
“I’m 34 now and I want to play for as long as I can and I just want to enjoy my cricket,” Moeen said in a statement released by the ECB.
“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.”
In a separate interview with ESPNcricinfo, Moeen said that he had “struggled” mentally during this summer’s Test series against India, which had helped him reach his decision to retire.
Having initially been left out of England’s squad, Moeen was recalled for the second Test at Lord’s and made his first home Test appearance since the 2019 Ashes.
Moeen played the first Test against Australia two years ago at Edgbaston before taking a break from all forms of cricket after he was omitted for the second match of the series.
England lost at Lord’s but levelled the series at Headingley, before India won at the Oval to take a 2-1 lead, after which the fifth Test at Old Trafford was postponed due to coronavirus concerns among India’s squad.
“I felt like I was done, to be honest,” Ali said. “I was hoping to play the last Test – there were a couple of milestones I wanted to pass – but once that (Old Trafford) game got called off, I realised that was it.
“Headingley was a great win but I just found I couldn’t concentrate. I’ve played rash shots before and had poor games before. But I just felt like I wasn’t in it. I’ve never felt that before. It’s not that I didn’t want to perform, I just didn’t feel like I was fully wholeheartedly into it.”