Rangana Herath put Sri Lanka within sight of victory in the second Test against Pakistan by taking four second-innings wickets.
Sri Lanka first innings 320
Pakistan first innings 332
Sri Lanka second innings 282
Pakistan second innings
K Manzoor c Dickwella b Prasad 10
A Shehzad lbw b Prasad 8
A Ali c Jayawardene b Herath 10
Y Khan lbw b Herath 8
Misbah c Jayawardene b Herath 3
A Shafiq st Dickwella b Herath 32
S Ahmed not out 38
A Rehman lbw b Perera 5
W Riaz not out 2
Extras (b 4, lb 6, nb 1) 11
Total (7 wickets; 40 overs) 127
Fall of wickets: 1-17, 2-21, 3-31, 4-39, 5-50, 6-105, 7-122
Chasing 271 to win the Test and level the two-match series, Pakistan were precariously placed on 127-7 at stumps on the fourth day with their last specialist batsman Sarfraz Ahmed (38 not out) batting with tailender Wahab Riaz (two).
Earlier, Pakistan's bowlers took eight Sri Lanka wickets for 105 in a remarkable fight back but the side crumbled on a turning Sinhalese Sports Club pitch.
Seamer Dhammika Prasad dismissed opener Khurram Manzoor (10) caught-behind with the total on 17 and four runs later trapped Ahmed Shehzad lbw for eight.
Herath then snared Azhar Ali (10) caught at slip by Mahela Jayawardene, Younis Khan lbw for eight and captain Misbah-ul-Haq also caught by Jayawardene.
A 55-run stand for the sixth wicket between Ahmed and Asad Shafiq developed but Shafiq (32) in a sudden loss of concentration charged down the pitch against Herath and was stumped by wicketkeeper Niroshan Dickwella.
Herath finished the day with a career-best test haul of 13-178, exceeding his previous best figures of 12-157 against Bangladesh last year.
Earlier Wahab Riaz and Saeed Ajmal took three wickets each to bowl out Sri Lanka for 282 in its second-innings giving themselves 271 to win.