Mystery spinner Hasaranga (3/13) and pacer Lahiru Kumara (2/30) shared five wickets among themselves to restrict Afghanistan to 144 for 8.
AS IT HAPPENED
Dhananjaya then took control of the Sri Lankan innings with a stroke unbeaten 66 off 42 balls as the reigning Asia Cup champions crossed the line with nine balls to spare.
With the win, Sri Lanka climbs to third place in Group 1.
Afghanistan, on the other hand, crashed out of the semi-final.
Sri Lanka defended a modest total and started well but Mujeeb ur Rahman (2/24) produced a lead to mark the end of Pathum Nissanka (10) who put the Sri Lankans under pressure. Fazalhaq Farooqi (1/22) bowled a maiden in the next over to tighten the screws.
But Kusal Mendis (25) hit back-to-back boundaries in the next over, both over mid-wicket as Sri Lanka slumped to 28 for 1 in the Powerplay.
Rashid Khan (2/31) in his first over as Mendis went for a premeditated sweep but overhead for the keeper to catch it.
Wanindu Hasaranga spun a web around Afghanistan and was awarded the @aramco #POTM 🌟#T20WorldCup https://t.co/6awsDKhGhO
— T20 World Cup (@T20WorldCup) 1667288236000
As the Afghans tried to build pressure by bowling dots, Sri Lanka continued to score at a healthy pace, milking boundaries and sixes every now and then.
Rashid’s second over went for 14 runs as De Silva hit fine leg off four before lofting the star spinner over deep mid-wicket for a six.
Dhananjaya continued the onslaught with a six off Mohammad Nabi in the next over to keep the required run rate within seven.
Along with Charith Asalanka (19), Dhananjaya put on a 54-run stand followed by a 42-run partnership with Bhanuka Rajapaksa (18) to take Sri Lanka to victory.
Earlier, while the Afghans were able to strike a few partnerships at the top, Sri Lanka did well to strike at regular intervals.
The ball swung in the first two overs, but after that the Sri Lankan bowlers struggled to get their lengths right. Rahmanullah Gurbaz (28) donned the role of the aggressor.
Sri Lanka lives to fight another day and knock Afghanistan out of the #T20World Cup semi-final.#AFGvSL | 📝:… https://t.co/Vr8t8yzfUA
— T20 World Cup (@T20WorldCup) 1667287627000
The wicket-keeper batsman danced off and hit a lovely straight drive Kasun Rajitha to register the first maximum of the innings.
The Afghans then hit three more fours and a six to collect 42 off the first six overs.
But just after the showdown, Kumara made the first breakthrough for the Sri Lankans.
Gurbaz looked to be big but there was just enough movement as the ball traveled through the gap between bat and pad to drop into the stumps.
The spinners were then able to slow down proceedings after the wicket, but Usman Ghani (27) stumped Kumara for a six over long on.
Eyeing the lead, Ghani tried to do so again in the 11th over from Hasaranga, who was brought back into the attack.
However, the Afghan was done for by a googly that had a touch of bounce to it and skipper Dasun Shanaka smashed it to deep mid-wicket.
Ibrahim Zadran (22) became Kumara’s second victim in the 13th over.
With wickets in hand, Mohammad Nabi (13) sent out a slower one to provide extra cover. But the captain could not stay in the middle for long as Afghanistan failed to fire in the overs and lost five wickets for 40 runs from the last 30 balls.
Sri Lanka were guilty of sloppy fielding once against.