The Sri Lankan skipper was batting on a punishing 151 and with him Suranga Lakmal was four not out as Sri Lanka progressed from their overnight score of 227-4 with stubborn batting.
Chandimal added 134 for the fifth wicket with Niroshan Dickwella, who made a career-best 83, before frustrating Pakistan further with a 92-run stand for the sixth wicket with Dilruwan Perera.
Perera made 33 as Pakistan's spin-cum-pace attack had to toil hard for the only wicket of Dickwella in the first session.
Dickwella hit nine boundaries and a six during his rapid, 117-ball knock. Chandimal reached his ninth Test century -- his first in four Tests as captain, and first against Pakistan -- by driving fast bowler Mohammad Amir through the covers for his 11th boundary.
It took him 383 minutes to reach the three-figure mark, ably lifting Sri Lanka from 61-3 when he came on to bat on Thursday.
Leg-spinner Yasir Shah has figures of 3-119 in 56 overs.