Mohammad Nabi helped Afghanistan finish strongly in the death after Mohammad Shahzad delivered a fine performance at the top of the order.
Pakistan captain Babar Azam broke Virat Kohli's record to become the fastest skipper to complete 1000 runs in the shortest format of international cricket.
With Pakistan needing 24 off the last two overs, Asif Ali went on the rampage against Janat, smashing four huge sixes to seal the match.
Afghanistan leg-spinner Rashid Khan on Friday became the quickest to take 100 T20 international wickets.
Asif Ali scored an unbeaten 25 runs off just seven deliveries, smashing four sixes in the 19th over to clinch the game for Pakistan.
Mohammad Nabi scored 35 runs off 32 deliveries and Gulbadin Naib made 35 runs off 25 balls to take Afghanistan to a good total.
Pakistan's interim head coach Saqlain Mushtaq would love it if his team got the opportunity to face India again, and beat them again in the final of the T20 World Cup 2021.
Mohammad Shahzad dived full length to his right and plucked the ball with one hand after Scotland's Matthew Cross edged it.
Mujeeb ur Rahman was the star bowler on the day as he recorded a fantastic five-wicket haul while conceding only 20 runs in four overs.
The Taliban Cricket Club, which came out in 2012, is a magnificent novel that highlights the situation in Afghanistan even in 2021.