Pakistan, replying to Sri Lanka's first innings total of 278, were 88-3 with Azhar Ali on 33 and Asad Shafiq on 14.
Sri Lanka added six runs to their overnight score of 272-8 before they were all out within 20 minutes of the start. Leg-spinner Yasir Shah finished with 5-78 runs and seamer Rahat Ali took three wickets.
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.