Former Sri Lanka captain Kumar Sangakkara will retire from first-class cricket in September at the end of England's county championship season.
The Surrey batsman, who quit test cricket in 2015 with 12,400 runs, is fifth on the all-time list of test run scorers, averaging 57.40 in 134 tests.
"You try to fight the inevitable but you need to get out while you're ahead," the 39-year-old told the BBC on Monday.
"It's the last time I'll play a four-day game here. I'll be 40 in a few months, this is about the end of my time in county cricket."
As well as his test exploits, Sangakkara has been one of the game's great limited overs batsmen and was part of the Sri Lanka team that reached the 2007 and 2011 World Cup finals, although they lost to Australia and India respectively.
His Twenty20 commitments will take him through to 2018, but his time in the longer format is almost over.
"My career might have a few more months (left) but that's about it," he added.
Having joined Surrey for the 2015 season, Sangakkara is still in good form. He scored over 1,000 first-class runs last term and hit two centuries against Middlesex at the weekend but felt it was still time to walk away.
"The biggest mistake that sometimes you can make is that you think you're better than you really are," he said.
"Cricketers, or any sort of sportsperson, have an expiry date and you need to walk away.
"I have been very lucky to play for as long as I did so but there's a lot more life to be lived away from the game."