(CNN) -- Pakistan captain Younus Khan failed in his attempt to break Brian Lara's world record for an individual Test innings when he was dismissed for 313 early on the final day of the first Test against Sri Lanka in Karachi.
Skipper Younus was the third Pakistani to score a Test triple hundred but missed out on Lara's mark.
Younus resumed overnight on 306, eyeing Lara's best of 400 set against England in the Antigua Test of 2004.
But he had added only six to his score when he played on to paceman Dilhara Fernando.
It left him 24 runs short of the previous Pakistan Test record of 337 made by the great Hanif Mohammad back in 1958, but his efforts made sure the high-scoring match would end in a draw.
But after his dismissal, Pakistan charged on to their best-ever Test match total of 765 for six wickets declared, with Kamran Akmal smashing an unbeaten 158.
Sri Lanka, who made an imposing 644 for seven wickets declared in their first innings, were briefly under pressure after losing three quick wickets, but batted out for a draw on 144 for five wickets.
In the Sri Lankan first innings their captain Mahela Jayawardene and Thilan Samaraweera combining to set a world record for a fourth wicket stand in Test matches.
Both made double centuries on the batting-friendly wicket at the national stadium to put on 437, breaking the previous best of England's Peter May and Colin Cowdrey against the West Indies in 1957.
It left Pakistan needing a big first innings total of their own to avoid the follow on and thanks to Younus the mark was passed on the fourth day.
Pakistan are returning to Test action on home soil for the first time in 16 months after a series of tours were canceled due to security fears.
The second Test starts in Lahore on Sunday.