The left-handed opening batsman, who captained England in 59 tests, said there was "nothing left in the tank" after enduring a poor run of form in nine tests this year in which he has averaged 18.62 runs compared with a career average of 44.88.
Since making a century on his test debut against India in 2006, Cook has become England's leading scorer in the longest form of the game and is the sixth highest scorer in five-day cricket with 12,254 runs, including 32 centuries.
"After much thought and deliberation over the last few months I have decided to announce my retirement from international cricket," Cook, who will play his 161st test starting on Friday (local time), said in a statement.
"I have achieved more than I could have ever imagined and feel very privileged to have played for such a long time alongside some of the greats of the English game," he added.
After leading England to two Ashes victories over Australia, Cook suffered a 5-0 series whitewash Down Under in 2013-14. He resigned from the captaincy in 2016 after a 4-0 defeat in India.
Cook, who will continue playing for his county Essex next season, thanked his mentor Graham Gooch, whose England test runs record of 8,900 he passed in 2015.
"There are too many people to thank individually, but a special mention must go to the Barmy Army and all supporters for their constant encouragement for the team and also a special mention to Graham Gooch," Cook said.
"Graham was my sounding board, especially in the early years of my career, spending hour after hour throwing balls at me with his dog stick. He made me realise you always need to keep improving whatever you are trying to achieve.
"My family and I have had 12 wonderful years fulfilling my dreams and this could not have been done without them."
England and Wales Cricket Board chairman Colin Graves hailed Cook's achievements as England's most capped player.
"Alastair's selfless dedication to the England cause and his desire to succeed are an object lesson to any professional cricketer ... he fully deserves to be remembered as one of England's greatest ever cricketers," Graves said in a statement..
England took an unassailable 3-1 lead in the current series against India after winning the fourth test by 60 runs in Southampton on Sunday.