An unbeaten century stand between Saud Shakeel and Agha Salman rescued Pakistan from a precarious 101-5 on the second day of the rain-hit opening Test in the city of Galle on Monday.
In response to Sri Lanka’s 312, Pakistan reached 221-5 when rain stopped play with the tourists still 91 runs behind.
Sri Lanka’s left-arm spinner Prabath Jayasuriya took three wickets, including skipper Babar Azam.
Sri Lanka batsman Dhananjaya de Silva had earlier made 122 to hand the hosts a respectable total.
Pakistan faltered in their reply before Shakeel, on 69, and Salman, on 61, put on 120 runs to steady the innings and thwart the Sri Lankan spinners.
The left and right-hand batting combination of Shakeel and Salman mixed the right dose of caution and aggression, with 12 boundaries and a six between them.
The pair showed maturity in tackling the spinners by using their feet to get to the pitch of the ball, with Pakistan scoring at nearly five runs an over.
Sri Lanka had come out roaring when pace bowler Kasun Rajitha got Imamul Haq out for one and Jayasuriya sent back Abdullah Shafique for 19.
The left-handed Shan Masood hit back as he smashed 39 off 30 balls but fell lbw to Ramesh Mendis, who was denied the wicket by the on-field umpire before Sri Lanka successfully reviewed.
Azam fell when he got an inside edge onto his pads and the ball looped to short leg, taken by wicketkeeper Sadeera Samarawickrama.
De Silva earlier moved from his overnight 94 to register his 10th Test ton in his 50th match to bolster Sri Lanka’s position from a shaky 54-4 on Sunday.
Pace spearhead Shaheen Shah Afridi, fellow quick Naseem Shah and leg-spinner Abrar Ahmed ended on three wickets each to bowl out Sri Lanka and lunch was called.
The second day’s play began early with revised timings for each of the three sessions and de Silva soon got to his hundred off Shaheen.
De Silva, who smashed 12 fours and three sixes, got useful runs with the lower order before he finally fell to Shah, who struck twice after Pakistan took the second new ball.