Younus Khan produced firm resistance for the visitors but once he was out for 87, defeat was inevitable.
With Pakistan inching closer to taking the match in to a final day, Suraj Randiv claimed his third wicket of the session to remove Junaid Khan as the tourists were 300 all out.
It was tough on Younus and Adnan Akmal, who finished the game unbeaten on 40, with Nuwam Kulasekara and Randiv both taking three wickets, the former for just 48 runs.
Sri Lanka had looked on course for an easy win as Pakistan resumed their second innings this morning on 36 for three, still 474 runs behind in the match, but the tourists reached tea having added 169 for the loss of two wickets today.
Younus and Asad Shafiq were the men to frustrate Sri Lanka, coming together after Saeed Ajmal was needlessly run out for 12 with only two runs added to the overnight score.
But together they played out almost two sessions, with Ajmal making 80 before he was caught in the slips off Rangana Herath, while Younus made it through to tea unbeaten on 81.
Both players had required a little luck early in their innings.
Younus was on nine when he appeared to hole out to mid-off, but the decision was sent upstairs with doubts over whether Tillakaratne Dilshan took the catch cleanly when diving forward, and the batsman got a reprieve.
Then, shortly before lunch, Shafiq was dropped by Kumar Sangakkara when on 33, although it was a difficult chance low down to his right with the ball travelling quickly.
Ajmal was out late in the afternoon session with the score on 189, and Pakistan made it to tea on 205 for five with Mohammad Ayub contributing five.
However, Younus’ resistance was up with seven more runs on the board when he became Kulasekara’s third victim with the new ball.
Kulasekara bowled straight with the batsman pushing out from the crease and the ball went straight through to keeper Mahela Jayawardene.
Younus’ innings of 87 came from 213 deliveries and included seven boundaries and his exit left Pakistan on 212 for six.
The visitors lost Mohammed Ayub lbw to Nuwan Pradeep for 22 with the score on 243 as they moved inexorably towards defeat.
Abdur Rehman had made 14 when he was caught by Sangakkara to leave Pakistan needing another 238 runs with just two wickets remaining and it was just a matter of time.
Umar Gul was out 14 runs later, although it was a contentious decision as it appeared there had been no bat involved when Thilan Samaraweera made a tumbling catch to his left.
However, the decision stood and Gul trudged off.
When Junaid became Randiv’s third successive victim it was all up for Pakistan.