The tourists, set a near impossible victory target of 510, were bowled out for 300 just before stumps on the fourth day despite defiant batting from Younis Khan and Asad Shafiq, as Sri Lanka took the lead in the three-match series.
The pair kept the Sri Lankan attack at bay for three hours to add 151 for the fifth wicket, Younis making 87 and Shafiq 80, before both fell on either side of the tea interval.
Off-spinner Randiv and seamer Kulasekara grabbed three wickets each to ensure Sri Lanka ended the match with a day to spare after Pakistan appeared to be taking the fight into the final day.
Randiv finished with seven wickets in the game, but it was team-mate Kumar Sangakkara who was named man-of-the-match for his unbeaten 199 in Sri Lanka's first innings.
Younis, 34, the most experienced batsman in the Pakistan side with 77 Test appearances, held the innings together during his 26th half-century in the five-day format.
Shafiq, a 26-year-old playing his 14th Test, matched his senior partner with a fluent knock that contained 13 hits to the fence.
But just when the duo appeared to have survived the entire afternoon session, Shafiq was dismissed against the run of play, edging left-arm spinner Rangana Herath to Mahela Jayawardene in the slips.
The partnership between Younis and Shafiq, who came together in the day's second over at 38-4, helped Pakistan salvage their reputation after the tourists were shot out for 100 in the first innings.
Younis, who went to tea on 81, fell in the first over with the second new ball when he edged Kulasekara to wicket-keeper Prasanna Jayawardene.
Seamer Nuwan Pradeep, playing his second Test, bagged his maiden Test wicket by trapping debutant Mohammad Ayub leg-before for 22 to send Pakistan reeling at 243-7.
Randiv claimed the last three wickets to give Sri Lanka their third win in the last five Tests, a turnaround in form following a dip after the retirement of legendary offspinner Muttiah Muralitharan in 2010.
Pakistan lost nightwatchman Saeed Ajmal in the day's second over, run out by a direct throw from the covers by Suraj Randiv.
Younis earned a reprieve on nine when Tillakaratne Dilshan picked up a low catch at mid-off, but television replays proved inconclusive whether the catch had been taken cleanly.
The second Test starts at the Sinhalese sports club in Colombo on June 30. while the third and final match will be played in Pallekele from July 8