Kumar Sangakkara is the second highest ODI run-scorer with 14,234

Former Sri Lanka captain Kumar Sangakkara says he will retire from first-class cricket after this season.

The 39-year-old Surrey batsman, who quit Test cricket in 2015, is fifth in the list of all-time Test run scorers.

"You try to fight the inevitable but you need to get out while you're ahead," he told BBC Sport.

"It's the last time I'll play a four-day game here [at Lord's]. I'll be 40 in a few months, this is about the end of my time in county cricket."

Sangakkara has contracts to honour in Twenty20 competitions taking him into 2018, but added: "My career might have a few more months [left] but that's about it."

He averaged more than 57 runs across 134 Tests, making 11 double centuries in that time, and joined Surrey for the 2015 season.

He scored more than 1,000 first-class runs last season but, despite hitting two centuries against Middlesex over the weekend, Sangakkara believes September is the right time to end his career in the longer format.

"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."

Fitting finale at Lord's

Sangakkara poses next to his portrait at the home of cricket

Few players will have signed off their last first-class match at Lord's in as much style as Sangakkara.

Alongside two match-saving centuries, the former Durham and Warwickshire player also passed 20,000 first-class runs.

Those feats coincided with him having his portrait - which hangs beside those of fellow Sri Lanka greats Mahela Jayawardene and Muttiah Muralitharan - unveiled in the Lord's pavilion.

"It was a great privilege and an honour. I think the artist has made me look better than I actually am," he joked.

"I sat here in my last Test at Lord's for Sri Lanka thinking 'I hope I get a hundred, but wouldn't it be funny if I get out for a duck'.

"You never think of [scoring a] hundred. You think 'I want to get a hundred', but then you just try and do your processes, you try and get through tough periods, and bat as the game develops.

"I wasn't aware I'd reached 20,000 [first-class] runs - I only really know how many Test and One-Day International runs I've scored - but it was really nice to find out that I passed [that milestone].

'The mercenary in me is still alive'

Sangakkara is one of only two players to have won Wisden Leading Cricketer in the World on two occasions

Sangakkara will head to the Caribbean Premier League at the end of June, with Aaron Finch signed by Surrey as his replacement during that period, and he says he will continue to play cricket past the end of the English domestic season.

But after more than 19 years of playing the professional game, the opportunity to watch the great batsman play his trademark cover drive is coming to an end.

Asked if he would play T20 cricket after his summer, he replied: "Yes, I think the mercenary in me is still alive.

"I've got a couple of contracts I have to honour this year and one at the start of the next year," he said. "No-one wants an old dog just playing for the sake of playing.

"I think it's a good thing that all these [Twenty20] competitions push you to perform. That's the incentive because otherwise, if you're going to be a part of a side just to be the benchmark name, that's a bit disappointing. "