Shehzad-Ali add 120 runs for second wicket as Pakistan trail by six runs with eight wickets in hand
Gritty half-centuries from Ahmed Shehzad and Azhar Ali steered Pakistan to 171 for two against Sri Lanka when bad light ended the third day of the second Test on Saturday.
Shehzad fell for 69 to the first ball after tea having shared a 120-run second-wicket partnership with Ali (64) who was unbeaten after registering his 20th Test fifty.
Veteran Younis Khan was on 23 not out at the close as Pakistan trailed Sri Lanka by six runs with eight wickets in hand at the P Sara Oval.
Earlier, Pakistan had claimed the last Sri Lankan wicket in the morning session to bowl out the hosts for 315 with leg-spinner Yasir Shah (6-96) dismissing Dushmantha Chameera 15 minutes after a rain-delayed start.
Younis held a good running catch to send back Chameera as Sri Lanka, pressing for a series-levelling victory, took a 177-run first-innings lead.
Shot out for 138 in their first innings, Pakistan did not make a great start in their second either as a leaden-footed Mohammad Hafeez (eight) poked at an Angelo Mathews delivery to be caught by Kumar Sangakkara in the slips.
Shehzad and Ali proved there were no demons in the pitch and they frequently used their feet to negate the threat posed by Sri Lanka's left-arm spinner Rangana Herath.
Shehzad overcame a blow on his helmet by a Chameera bouncer to bring up his fifty in the 35th over.
The opener, however, perished straight after tea when he edged a pull shot against Dhammika Prasad through to keeper Dinesh Chandimal.
Kaushal bags five wickets as Pakistan dismissed for 138
Sri Lanka lead by 166 runs after Shah takes five
Shafiq, Sarfraz give Pakistan control against Sri Lanka
Pakistan recall opener Ahmed Shehzad for Sri Lanka Tests
Sangakkara to retire after India series