Yadav hit a 44-ball 53 with six boundaries and Chahar remained unbeaten on 69 as India recovered from an early setback to overtake Sri Lanka’s total of 275 with three wickets and five balls to spare.
Even then Chahar’s innings had more significance as he batted until the end and was associated in an unfinished 84-run stand with Bhuvneshwar Kumar, who held on determinedly for an unbeaten 19.
This was after Wanindu Hasaranga had brought Sri Lanka back into the game with three vital wickets in the middle of the innings to keep their hopes alive.
India also clinched the three-match ODI series with a game to spare and the third and final match will be played on Friday at the same venue.
Earlier two fighting half-centuries from opener Avishka Fernando and middle order batsman Charith Asalanka helped Sri Lanka to reach a competitive 275 for nine.
Fernando struck exactly 50 from 71 deliveries with the help of one six and four boundaries and also added 77 for the first wicket with Minod Bhanuka (36) after the home side had elected to bat first.
However, India came back into the game with spinner Yuzvendra Chahal striking twice in successive deliveries to remove Bhanuka and Bhanuka Rajapaksa for a first ball duck.
Dhananjaya de Silva joined Fernando and the pair rebuild the innings with a third wicket stand of 47 runs as Sri Lanka brought up their 100 runs in the 20th over.
After Fernando departed in the 25th over, Asalanka took over the main role and played a splendid innings before he was seventh out with the score at 244.
Asalanka raced to his half-century from 56 deliveries and went on to hit a top score of 65 with the help of six boundaries.
All-rounder Chamika Karunaratne then added the finishing touches with an unbeaten 44, which included five boundaries.
Bhuvneshwar Kumar and Chahal captured three wickets each while Deepak Chahar finished with two wickets.