Kumar Sangakkara was stranded on an unbeaten 199 even as Sri Lanka took charge of the first cricket Test against Pakistan in Galle on Saturday.
The left-hander's monumental nine-hour effort saw the hosts recover from 335-5 in the morning session to post 472 in their first innings on the second day.
Pakistan were tottering at 48 for five in reply at stumps with seamer Nuwan Kulasekara and off-spinner Suraj Randiv both taking two wickets each off successive deliveries.
Kulasekara removed opener Taufeeq Umar and Azhar Ali, while Randiv dismissed skipper Mohammad Hafeez (20) and nightwatchman Saeed Ajmal in gloomy conditions.
Asad Shafiq fell to Rangana Herath, leaving veteran Younis Khan unbeaten on 15 with Pakistan still 225 runs away from saving the follow-on.
Sangakkara missed out on his ninth double-century in Test cricket partly due to an error in the scoreboard on the ground which showed him on 194 when his score was actually on 193.
With last man Nuwan Pradeep at the other end, Sangakkara smashed Ajmal for a six and raised his arms in celebrations believing he had reached the coveted double-century.
Team-mates, who saw the correct score on television, immediately signalled to Sankgakkara that he still needed one more run -- but to no avail.
Unable to get a run off the last ball of the over, Sangakkara could only watch from the non-striker's end as Pradeep was bowled by Hafeez for no score in the next over.
Sangakkara, who was on 182 when the ninth wicket fell, scored all the 17 runs in the last-wicket stand, but found himself agonisingly short of the coveted mark.
Sangakkara, a 34-year-old veteran of 109 Tests, has eight double hundreds in his 29 three-figure knocks in Test cricket.
The left-hander held the innings together after Ajmal claimed his sixth five-wicket haul in 21 Tests to restrict Sri Lanka when the hosts resumed at 300-2.
The off-spinner, who had taken both wickets on Friday, struck thrice in the morning session.
Ajmal dismissed Sri Lankan skipper Mahela Jayawardene for 62, before removing Thilan Samaraweera and Angelo Mathews off successive balls soon after the drinks break.
Mahela Jayawardene added seven runs to his overnight score of 55 when he was bowled by Ajmal, ending a 128-run partnership for the third wicket with Sangakkara.
Ajmal had Samaraweera stumped by Adnan Akmal for six and beat Mathews in the air to pick up an easy return catch with the fifth and sixth deliveries of his 30th over.
Sangakkara denied Ajmal a hat-trick in the bowler's next over and put on 80 for the sixth wicket with Prasanna Jayawardene, who made 48.
Ajmal, 34, was the world's leading Test wicket-taker in 2011 with 50 scalps in eight matches. He grabbed 24 wickets in Pakistan's 3-0 whitewash of top-ranked England earlier this year.
Prasanna Jayawardene fell soon after a 16-minute interruption due to rain in the post-lunch session when he was caught behind off Hafeez.
The tourists cleaned up the tail on either side of tea with Hafeez finishing with three for 55 and Abdur Rehman with one for 126.