Sri Lanka's Angelo Mathews was "timed out" in a rare first in international cricket but Charith Asalanka's second ODI ton helped Sri Lanka to a good total in Delhi.
Opting to bowl first, Bangladesh found an early breakthrough when Mushfiqur Rahim pulled off a sensational catch behind the wicket to dismiss Kusal Perera in the first over.
Kusal Mendis, who got off to a rather sedate start in uncharacteristic fashion, was dismissed by Shakib in his first over with the batter playing a mistimed stroke straight to mid-on.
Tanzim Hasan Sakib compounded their woes next over when Pathum Nissanka was cleaned up by a delivery shaping back in.
Charith Asalanka and Sadeera Samarwickrama put on the resurrection act, but things turned dramatically Bangladesh's way in the 25th over when Samarawickrama was dismissed following which Angelo Mathews was timed out for taking too much time to walk in.
The veteran Sri Lankan all-rounder took his time to walk in and then found that his helmet strap had broken and further delayed his entry. An appeal from Bangladesh followed and it was upheld with the Cricket World Cup playing conditions stating that a batter can be "timed out" if the batter is not "ready to receive the next ball within 2 minutes of the dismissal or retirement."
Asalanka carried the side forward amidst the chaos with Dhananjaya de Silva offering good support and the half-century stand lifted Sri Lanka out of trouble.
De Silva fell for 34 in another odd sequence of play. The Sri Lankan was stumped out despite Rahim removing the bails with his gloves first as the Bangladesh wicketkeeper could take his time and recover to remove the stumps a second time with de Silva still not making an attempt to get back.
Asalanka went on to make a fine hundred with Maheesh Theekshana aiding him but the final flourish never arrived as Bangladesh kept chipping away with wickets. They finished on 279, making just 56 runs in the last 57 balls of the innings.
Earlier, Bangladesh won the toss and opted to bowl first against Sri Lanka at the Arun Jaitley Stadium in Delhi.
Sri Lanka rang in two changes with Kusal Perera and Dhananjaya de Silva coming in for Dimuth Karunaratne and Dushan Hemantha. The 1996 champions chase a win to keep their semi-final hopes alive at the ICC Men's Cricket World Cup 2023.
Bangladesh made a change of their own with Tanzim Hasan Sakib replacing Mustafizur Rahman.
Sri Lanka's campaign has largely been derailed by injuries to key players but they could still snatch a place in the knockout stages with a triumph over Bangladesh at Arun Jaitley Stadium in Delhi, then another against New Zealand on 9 November.
The back-to-back victories would need to be settled by significant margins to give Sri Lanka's net run rate a healthy boost to compete with any other teams that finish on eight points, while also hoping that Pakistan and Afghanistan lose all of their remaining matches.
The outcome of this clash carries extra weight with a spot in the ICC Champions Trophy also on the line, as only the top eight sides at the end of the World Cup qualify for the next 50-over event in 2025.
Sri Lanka currently sit in seventh place with four points and only ahead of Netherlands on net run rate, while Bangladesh have two points with a slim margin in net run rate keeping them from bottom spot in the standings.
Bangladesh will have their backs to the wall following six consecutive defeats but showed that they can be a dangerous opponent when starting the tournament with a resounding victory over surprise packets Afghanistan.
While the semi-finals are already out of reach for Shakib Al Hasan's outfit, a second win in the tournament would at least allow them to finish it on a high.