Bangladesh bowled out Pakistan for 172 on day four and they will need to chase 185 to win the second Test and the series at the Rawalpindi Cricket Stadium.
Hasan Mahmud and Nahid Rana wrecked havoc, picking five and four wickets, respectively.
The hosts started the day on 9/2 and had a decent start courtesy of Saim Ayub and skipper Shan Masood, adding 38 runs.
Ayub was the first man to depart as Taskin Ahmed took his wicket. He made 20 runs off 35 balls.
Masood managed 28 runs off 34 balls and was removed by Rana soon after.
Rana managed to dismiss Babar Azam (11) and Saud Shakeel (2) in quick succession, leaving Pakistan in more trouble.
Babar's poor run continued in the Tests as he now batted 16 innings without a Test fifty.
Meanwhile, Mohammad Rizwan and Salman Ali Agha made valuable contributions at the back end. The pair added 55 runs for the seventh wicket.
Mahmud was brought by Bangladesh skipper Najmul Hasan Shanto and he delivered by removed Rizwan and Mohammad Ali on back-to-back deliveries.
Rizwan made 43 runs off 73 balls which included five fours. Meanwhile, Abrar Ahmed departed after facing 12 balls for his two.
Mahmud dismissed Mir Hamza (4) to wrap up Pakistan's innings on 172.
Salman added vital runs for Pakistan and remained unbeaten on 47.
Mahmud registered his first fifer in Test cricket, becoming first Bangladesh pacer to take this many wickets in an innings in Pakistan.
Earlier at the end of third day's play, opener Abdullah Shafique was routed for 3 and night watchman Khurram Shahzad fell for naught.
On Sunday, Bangladesh's Litton Das hit a defiant 138 and Mehidy Hasan Miraz 78 as the tourists recovered from a precarious position to post 262 all out after Shahzad bagged six wickets on the third day of the second test.
Responding to Pakistan's first innings 274, Bangladesh were reduced to 26-6 and in danger of following on amid fiery fast bowling in the morning but Das and Miraz put together a 165-run stand for the seventh wicket to steady the ship.
Das hit 13 fours and four sixes in his 228-ball knock while Miraz, who claimed five wickets to skittle out Pakistan, showed his ability with the bat by hitting 12 fours and a six.
It is mentionable that, Bangladesh lead the two-match series 1-0 after winning the Test series opener by 10 wickets.