Spinner Taijul Islam broke the resistance by bowling Salman for 71 at the team score of 296, ending a crucial 134-run partnership with Rizwan.
Taijul struck again in the very next over, dismissing Hasan Ali for a duck.
Chasing a record target of 437, Pakistan reached 315/7 after 85 overs. Bangladesh now need just three more wickets to seal a historic Test victory, while Pakistan still require another 121 runs to complete an extraordinary chase.
Earlier, Pakistan were in serious trouble at 162/5 and looked on course for a collapse. However, Rizwan and Salman stood firm and launched a strong counterattack. Returning after tea, both batters shifted gears and took the attack to the Bangladesh bowlers with aggressive stroke play.
Rizwan [75*] brought up the 14th half-century of his Test career off 86 deliveries. Salman matched the momentum with an impressive knock, reaching his 12th Test fifty in just 74 balls in a one-day-style innings.
Their twin half-centuries and century partnership had briefly reignited Pakistan’s hopes of an unlikely victory.
Bangladesh had earlier been bowled out for 390 in their second innings on Monday, adding to their first-innings lead of 46 runs to set Pakistan a challenging target of 437.
The highest successful run chase in Test cricket history remains the West Indies’ chase of 418 against Australia in Antigua in 2003, where they won by three wickets.
Only three other teams have successfully chased targets above 400 in Test cricket. For Pakistan to win this match, they would need to create a new world record.