Sri Lankan spinner Wanindu Hasaranga took three wickets as Afghanistan made 144-8 in their Twenty20 World Cup Group 1 clash at the Gabba in Brisbane on Tuesday.
The leg-spinner bowled superbly in his four overs, finishing with 3-13 and not conceding a boundary in his spell.
Both sides still have a mathematical chance of making the top two in the group, and therefore the semi-finals, but whoever loses is effectively out of the World Cup.
After skipper Mohammad Nabi won the toss and decided to bat, Afghanistan got through the six-over power play without losing a wicket.
But on the first ball of the seventh over, Rahmanullah Gurbaz was cleaned-bowled by Lahiru Kumara for a sparkling 28 off 24 balls, including two huge sixes.
Gurbaz's fellow opener Usman Ghani was next to go when he was caught on the mid-wicket boundary off Hasaranga, leaving Afghanistan 68-2.
Kumara picked up his second and Sri Lanka's third when Ibrahim Zadran holed out to Bhanuka Rajapaksa for 22 with the score on 90 after 12.2 overs.
Afghanistan continued to look like they were going to break out with some big overs, but Sri Lanka's bowlers were able to keep them in check.
Najib Zadran eventually lost patience and tried to smash Dhananjaya de Silva out of the ground, only to find Hasaranga on the long-on boundary, with Afghanistan 113-4.
The Afghans then suffered a cruel blow when Gulbadin Naib slipped while trying to regain his crease and was run out as he desperately tried to make his ground.
They tried to push on, but Sri Lanka held their nerve and restricted the Afghans over the closing overs.