Colombo: Sri Lanka, trailing by 12 runs on the first innings, were 177-2 in their second knock at stumps on the third day of the second Test against Pakistan in Colombo on Saturday. (Scorecard)
Kumar Sangakkara was unbeaten on 54 and the retiring Mahela Jayawardene was on 49 in his final Test innings, with the pair having put on 98 for the unbroken third wicket.
Sri Lanka lead by 165 runs with eight wickets in hand.
Earlier, Pakistan wicket-keeper Sarfraz Ahmed scored 103, his maiden Test century, and Sri Lanka's left-arm spinner Rangana Herath claimed nine wickets.
Pakistan took their overnight score of 244-6 to 332 before they were all out at the stroke of lunch on the third day.
Sri Lanka, who won the first Test in Galle, had scored 320 in their first innings.
Herath finished with nine for 127, surpassing his previous best of 7-89 against Bangladesh in Colombo last year.