Sharma scored 137 off just 126 balls with 14 boundaries and three sixes, sharing a 122 -run fourth-wicket partnership with Suresh Raina (65) to help India reach 302-6 after some tight Bangladesh bowling contained much of the innings.
While Bangladesh rarely appeared likely to win in reply, it produced a determined innings at the Melbourne Cricket Ground in its first World Cup quarterfinal.
India hadn't won a competitive match in the two months leading up to the World Cup, but has now won seven straight to give Mahendra Singh Dhoni his 100th ODI win as India captain.
"We can't shy away from the fact that we are playing some good cricket. But at the same time a month back we were struggling," Dhoni said. "Now we are doing much better. It's difficult to pin point how it changed."
Tamim Iqbal timed four boundaries in a run-a-ball 25 before being caught behind off Yadav (4-31). Fellow opener Imran Kayes was run out off the next ball for 5 and Bangladesh didn't recover momentum.
Sarkar and Mahmudullah cautiously steadied the innings in a 40-run partnership until Mahmudullah was caught on the boundary rope by Dhawan for 21.
Jobjee awards bumper prize winner of World Cup Fest 2022
Sarkar made 29 before being caught behind off Shami to leave Bangladesh in serious trouble at 90-4.
Shakib Al Hasan made just 10 before being caught by Shami off Jadeja and Mushfiqur Rahim offered an easy catch for wicketkeeper Mahendra Singh Dhoni and departed for 27.
Nasir Hossain top scored with 35 before being caught by Ashwin in the 43rd over.
Bangladesh captain Mushrafe Mortaza added just 1 run before being caught behind of Mohit Sharma, Rubel Hossain was caught by Ashwin off Yadav for a duck and Rubel Hossain (0) became Yadav's fourth victim to finish the match.
"Could have been, we'd like to bat first as well, But can't control that," Bangladesh captain Mashrafe said. "300 is difficult to chase. I think, except today, they should be happy. Most of our players are just starting their careers and they should be very happy with their efforts and the fans should be happy as well."
After India won the toss, openers Shikhar Dhawan and Sharma calmly built a strong platform, sharing a 75-run stand until Dhawan was caught outside his crease playing at a Shakib Al Hasan ball and was stumped for 30.
Bangladesh made the most of the breakthrough, dismissing Virat Kohli for 3 in the next over, caught behind off Rubel Hossain.
Bangladesh's bowlers, led by Taskin Ahmed (3-69) produced some tight and varied deliveries to successfully reign in the Indian batsmen and prevent them putting on a significant partnership.
After Sharma brought up his 50 off 70 balls, he and Ajinkya Rahane opened up with some fluid strokes in a bid to build the run rate for the second half of the innings.
Raina, who survived a review for lbw while on 10, helped reinvigorate the late Indian Innings as he and Sharma upped the tempo and targeted the boundary.
After play was suspended briefly for a rain shower, Sharma survived a contentious umpire's decision while on 90 when he was caught at deep mid-wicket only for a no ball to be called for a high full toss delivery. The Bangladeshis vigorously argued the decision as replays showed the ball appeared to be legal.
Sharma brought up his maiden World Cup century — and second career ton at the MCG — off Mortaza in the 42nd over, raising his bat to acknowledge the cheers of a raucous pro-India crowd of almost 55,000. Sharma's innings ended in the 47th over, bowled by Ahmed.