India was all out in its second innings for 112 after chasing what had seemed a modest victory target of 176 in the three-test series opener.
Left-arm spinner Rangana Herath took 7-48 while Ajinkya Rahane top scored for India on 36.
Sri Lanka was bowled out for 183 in its first innings after electing to bat first and India took a lead of 192 runs after piling on 375 in reply.
Sri Lanka was heading toward an innings defeat Friday when it was reduced to 95-5 in its second innings, but an unbeaten 162 by wicketkeeper Dinesh Chandimal revived the hosts' fortunes, and the bowlers then put them on top.
Foreign Minister Paudyal discusses connectivity issue with Sri...