Pakistan captain Younis Khan hit a defiant century to steer his struggling side to 296 for three at the end of the third day of the first Test against Sri Lanka on Monday.
Younis ground out a patient and unbeaten 149 runs at the national stadium to keep alive the home side's chances of surviving the Test after Sri Lanka took control with a first innings total of 644 for seven declared.
Pakistan require another 149 to avoid the follow-on.
Younis, leading Pakistan in a Test for the fifth time, opened his score in the second over of the day and went on to make his 16th Test hundred and fourth against Sri Lanka in 11 Tests.
His 149 came from 282 balls with 17 fours while his hundred came from 191 balls in the final over before tea.
His third wicket partnership of 149 with his immediate predecessor as captain, Shoaib Malik (56), kept the Sri Lankan spinners at bay with the pitch starting to take more turn.
The turn encouraged Sri Lankan skipper Mahela Jayawardene to operate with the second new ball with pacer Chaminda Vaas and off-spinner Muttiah Muralitharan.
Sri Lanka gained two successes in the day dismissing debutant opener, Khurrum Manzoor (27) and Malik.
Manzoor fell caught behind to Ajantha Mendis in the first session while Malik was run out shortly after lunch after hitting the ball straight to Muralitharan at mid-off and trying to steal a quick single.
Sri Lanka coach Trevor Bayliss praised Younis's performance.
"He is a very good batsman. But in his first Test as appointed captain I thought he sent out a clear and positive message when he came out to bat last night instead of a nightwatchman," Bayliss said.
The Australian said that, despite the Test was being played on a very flat wicket, there was still only one team that could win the Test.
"The likely result appears to be a draw but if we play good cricket we can still win this Test," he added.