Pakistan won the toss and opted to bat first.
In their first innings, the visitors only managed 138 runs on the board with Mohammad Hafeez and Azhar Ali being the top scorers with 42 and 26 runs respectively.
Tharindu Kaushal took five wickets in the first innings while Dhammika Prasad and Dushmanth Chameera took three and one wickets respectively.
The hosts scored 315 runs in their first innings with Kaushal Silva scoring 80 runs and Captain Angelo Mathews putting up 77 runs.
Yasir Shah took six wickets for Pakistan while Mohammad Hafeez, Junaid Khan and Zulfiqar Babar grabbed one wicket each.
The green shirts, in their second innings, scored 329 runs setting a target of 153 runs for the Sri Lankan side to win. Captain Azhar Ali made 117 while Ahmed Shehzad scored 69 runs in the innings.
Prasad took four wickets in the innings while Chameera grabbed three wickets. Angelo Mathews dismissed two batsmen while Rangana Herath also dismissed one batsman.
Sri Lanka lost only three wickets in the run chase and reached the target within 26.3 overs.
Dimuth Karunarathne scored a half century while Angelo Mathews remained unbeatean at 43 runs and Kithuruwan Vithanage made 34 runs.
Yasir Shah took two wickets in the innings while Zulfiqar Babar took one wicket.
The third and final test match will be played at Pallekele from 3rd to 7th July.