Sri Lanka were 228 for 5 in their second innings at stumps on the third day against Pakistan in Pallekele cricket test.
Skipper Angelo Mathews was unbeaten on 77 and Dinesh Chandimal was on 39, with the hosts leading by 291 runs and five wickets in hand.
Left-arm Seamer Rahat Ali grabbed two quick wickets and Ehsan Adil took one to leave sri lanka tottering in the morning session.
Rahat bowled first innings century-maker Dimuth Karunaratne for 10 and Yorked Lahiru Thirimanne for no score.
In between, Ehsan had Kaushal Silva caught in the slips by a diving Misbah-ul Haq for three.
Angelo Mathews led from the front against Pakistani attack, adding 45 for the fourth wicket with Upul Tharanga and 81 for the fifth with Jehan Mubarak.
Mubarak marked his recall to the test side after almost eight years with a gutsy 35 before he was caught at short-leg off Yasir Shah in the final session.
Upul Tharanga scored 48 runs. Dinesh Chandimal returned to form with 39 not out, helping his captain put on 67 for the sixth wicket before bad light ended the day's play early.
Yasir Shah and Rahat Ali finished with two wickets each.
Earlier, the tourists added six runs to their overnight score of 209 for 9 before they were all out for 215 in the day's second over in reply to Sri Lanka's first innings total of 278.
Pakistan's six runs in the morning all came off the bat of Sarfraz Ahmed, who remained unbeaten on 78.
Last man Imran Khan survived for seven deliveries before he was bowled by off-spinner Tharindu Kaushal for zero.
Kaushal, Dhammika Prasad and Nuwan Pradeep finished with three wickets each.
The series is tied at 1-1 after Pakistan won the first test in Galle by 10 wickets and Sri Lanka took the second in Colombo by seven wickets.
Chile won the Copa America for the first time, when they beat Argentina 4-1 on penalties after the match had ended 0-0 following 90 minutes and extra-time.
Alexis Sanchez netted the clinching goal from the spot after Gonzalo Higuain and ever Banega had missed for Argentina.
The nail-biting finish came after a tense game during which neither side dominated and clear-cut chances were few and far between.
Chile, who had beaten Argentina just once in 38 competitive matches before the final, won the title for the first time in the tournament's 99-year history in front of an ecstatic home crowd at the national stadium.