Seamer Dhammika Prasad skittled Pakistan with a four-wicket haul to put Sri Lanka on top in the second Test in Colombo on Sunday despite a defiant century from Azhar Ali.
Pakistan, who trailed by 177 runs in the first innings, were bowled out for 329 in their second knock by tea on the fourth day to leave the hosts a target of 153 runs to level the three-match series.
Pakistan won the first Test in Galle by 10 wickets.
Azhar anchored the Pakistan innings with a defiant 117, his ninth Test innings, but found little support at the other end as the last six wickets tumbled for 55 runs.
Wicket-keeper Dinesh Chandimal grabbed five catches and also effected a stumping, while debutant fast bowler Dushmantha Chameera claimed three wickets in an impressive Sri Lankan display at the P. Sara Oval.
Azhar twice avoided dismissals during his marathon vigil that lasted eight hours and 33 minutes, in which he faced 308 deliveries and hit just six boundaries.
Azhar had added four runs to his overnight score of 64 when he was dropped by a diving Kumar Sangakkara at first slip off Prasad, a catch that Chandimal could have attempted.
When he moved to 114, Azhar was saved by a television review after umpire Sundaram Ravi had declared him leg-before off Prasad.
But the Pakistan number three was stumped soon after when he tried to hit left-arm spinner Rangana Herath out of the stadium.
Pakistan, who started the day at 2-171, lost two important wickets in the morning session to go to lunch at 4-244.
Sri Lanka secured a crucial wicket when overnight batsman Younis Khan edged an outswinger from Angelo Mathews to Chandimal, ending a 73-run stand for the third wicket with Azhar.
Younis, who had hoped for a big knock in his 100th Test appearance, scored 40 after making six in the first innings.
Skipper Misbah-ul Haq, seemingly disturbed by a band playing in the stands, requested the umpires to stop the music saying it `upset his concentration’.
The band obliged, but Misbah did not last long at the crease as he was trapped leg-before by Prasad for 22.
Pakistan lost Asad Shafiq after lunch when he was caught down the leg-side by Chandimal off Chameera for 27, triggering a collapse from a comfortable 4-274.
When Chandimal picked up his fourth catch in the innings to remove Sarfraz Ahmed off Prasad for 16, Pakistan were only 124 runs ahead with four wickets in hand.
Between the two dismissals, Azhar reached his century off the 266th delivery he faced, driving Chameera for two runs.
Prasad bowled Yasir Shah for zero before Chameera claimed the last two wickets, including that of Wahab Riaz, who came out to bat despite suffering a hairline fracture on his left hand.