Captain Dinesh Chandimal made an unbeaten 155 as Sri Lanka put the pressure on Pakistan on the second day of the first Test in Abu Dhabi on Friday.
Openers Sami Aslam (31 not out) and Shan Masood (30 not out) negotiated 23 overs to take Pakistan to 64-0, still trailing Sri Lanka's first-innings total of 419 by 355 runs.
They need another 156 to avoid the follow-on, a task which should be simple on a flat Sheikh Zayed Stadium pitch.
Both Masood and Aslam, opening for the first time together, looked assured as Sri Lanka attacked through all its three spinners and two seamers in short spells.
But it was a memorable day for Sri Lankan skipper Chandimal, whose marathon knock of over nine hours in hot conditions propelled his team to a strong total.
He came in to bat with his team in trouble at 61-3 on Thursday, but led the fightback in a fourth-wicket stand of 100 with Dimuth Karunaratne (93).
On Friday, after Sri Lanka resumed at 227-4, Chandimal added 134 for the fifth wicket with Niroshan Dickwella (83) and another 92 for the sixth with Dilruwan Perera, who made 33.
Chandimal faced 372 balls and struck 14 boundaries to leave Pakistan toiling for wickets, before the tail succumbed to some good pace bowling by Mohammad Abbas, who took 3-75.
Leg-spinner Yasir Shah finished with 3-120 in a marathon 57 overs of hard work.
The Chandimal-Dickwella stand was only broken in the 22nd over of the day when Dickwella played on to fast bowler Hasan Ali, spurning a good chance to post his maiden Test hundred.
Dickwella hit nine boundaries and a six during his rapid 117-ball knock and bettered his previous best Test effort of 81, made against Zimbabwe in Colombo earlier this year.
Chandimal reached his ninth Test century -- his first in four matches as captain, and first against Pakistan -- by driving left-arm paceman Mohammad Amir through the covers for his 11th boundary.
Pakistan's misery was compounded as they did get Perera twice on nought, but the all-rounder made successful reviews on both decisions -- once each off Shah and Haris Sohail.
Perera also survived a stumping decision before finally falling to part-timer Sohail for his first wicket.
Shah then had Rangana Herath for four before Abbas took the wickets of Lakshan Sundakan (eight) and Nuwan Pradeep (nought) from successive deliveries.