Jayawardene, 37, who has been a stalwart of the batting order since making his debut against India in 1997, said it was not an easy decision but ultimately he felt it was the right time to go.
"It was not an easy decision to make given that it has been a great privilege and honour representing my country during the past 18 years," Jayawardene said in a letter to Sri Lanka Cricket.
"But I believe this is the right time [to go]."
Jayawardene is Test cricket's sixth-highest run-getter, amassing 11,493 runs in his stellar career and ranking alongside fellow Sri Lanka stalwart Kumar Sangakkara.
Jayawardene, a member of the Sri Lankan team which achieved last month's surprise 1-0 Test win in England, has played 145 Tests and averages just over 50 with 33 centuries.
The right-hander retired from Twenty20 internationals this April but will still be available for one-day international cricket.
Chief cricket selector and former team-mate Sanath Jayasuriya said Jayawardene wanted to concentrate on training for next year's World Cup in Australia and New Zealand.
"He wants to give up Test cricket so that he can concentrate on one-day matches. He wants to be fully prepared for the next World Cup," Jayasuriya told AFP.
"We respect his decision."
Jayawardene is expected to play in the series against Pakistan at home starting on August 14.
He has been in fine form recently, scoring an unbeaten double-century against Bangladesh in the first Test in Dhaka in January. He made 203 not out, his seventh double-century.
Jayasuriya, a former Sri Lanka skipper, discussed Jayawardene's retirement plans with Sri Lanka's cricket board before it released the retirement letter on Monday.
"By stepping down from the Test squad he is also making way for a younger player to come in. We thank him for all he has done for cricket in the country," Jayasuriya said.
Jayawardene is expected to receive a standing ovation when he takes to the ground in the southern city of Galle on Wednesday for the first Test against South Africa.
COMMENTS (1)
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ
Will greatly miss watching these too bat in tandem and score for Sri lanka in countless innings. http://cricket-cup.blogspot.com/2014/07/mahela-jayawardene-to-quit-test-cricket.html