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 their three spinners and two seamers in short spells.
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.
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.
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.
Disclaimer: No Business Standard Journalist was involved in creation of this content
