Habibul Bashar scored 82 runs as Bangladesh provided Pakistan with some unexpected resistance to grind out a 105-run lead with seven second innings wickets in hand after the third day of the first Test on Friday.
Bashar helped Bangladesh to 163 for three after they had bowled Pakistan out for 346 in the morning, having added just 45 runs to their overnight score of 301 for five.
Mohammad Rafique and Mashrafe Mortaza ended with three wickets apiece after the home side failed to capitalise on a blistering 170 from Yasir Hameed on his Test debut on Thursday.
Pakistan captain Rashid Latif was 54 not out as he ran out of partners. The home side had a lead of just 58 runs on Bangladesh's first innings of 288.
Bashar, who scored 71 in the first innings, made Pakistan play dearly for a dropped catch at second slip by Yasir Hameed.
He shared partnerships of 54 with Hannan Sarkar (30) and an unbeaten 80 with debutant Rajih Saleh (27) to boost the innings.
PAKISTAN COLLAPSE
Earlier, the Bangladesh bowlers stayed disciplined on a slow track and chipped away at the innings for close to two hours in the morning session.
Their discipline continued when they came out to bat with 30 minutes remaining before lunch with a fired-up Shoaib Akhtar bowling a series of quick short-pitched deliveries.
While Akhtar looked threatening in five spells spanning over 15 overs he managed only one wicket, trapping opener Javed Omer leg before immediately after lunch when Bangladesh were on 11.
Sarkar and Baisul then combined for their partnership before Sarkar was leg before to part-time spinner Mohammad Hafeez while attempting an extravagant sweep shot.
Bangladesh went to tea at 77 for two but lost Sanwar Hossain just 19 minutes into the final session when he was given leg before to Shabbir Ahmed to leave Bangladesh 83 for three.
But Bashar, who reached his half century from 86 balls with four boundaries, and Saleh, who ground out 27 from 94 balls, then steadied the innings and went through to the close.
Scoreboard
Bangladesh (1st innings): 288 (Habibul Bashar 71)
Pakistan (1st innings) (overnight 301-5):
Mohammad Hafeez c Javed Omar b Mashrafe Mortaza 2
Taufiq Umar c Javed Omar b Mohammad Rafique 38
Yasir Hameed c Mohammad Rafique b Mashrafe Mortaza 170
Inzamamul Haq c Rajin Saleh b Tapash Baisya 0
Yousuf Youhana c and b Rajin Saleh 46
Misbahul Haq lbw b Mashrafe Mortaza 13
Rashid Latif not out 54
Shoaib Akhtar b Mohammad Rafique 1
Shabbir Ahmed c Rajin Saleh b Mohammad Rafique 6
Danish Kaneria c and b Khaled Mehmud 8
Umar Gul run out 0
Extras: (lb-4 nb-4) 8
Total: (all out, 117 overs) 346
Fall of wickets: 1-5, 2-102, 3-103, 4-234, 5-270, 6-304, 7-307, 8-323, 9-338
Bowling: Mashrafe Mortaza 19-3-68-3 (nb-3), Tapash Baisya 17-6-42-1 (nb-1), Khaled Mahmud 17-2-74-1, Mohammad Rafique 32-9-76-3, Sanwar Hossain 9-0-23-0, Alok Kapali 18-3-50-0, Rajin Saleh 5-0-9-1
Bangladesh (2nd innings):
Hannan Sarkar lbw b Mohammad Hafeez 30
Javed Omar lbw b Shoaib Akhtar 13
Habibul Bashar not out 82
Sanwar Hossain lbw b Shabbir Ahmed 3
Rajin Saleh not out 27
Extras: (lb-6 nb-2) 8
Total: (for three wickets, 65 overs) 163
Fall of wickets: 1-19, 2-73, 3-83
To bat: Alok Kapali, Khaled Mashud, Khaled Mahmud, Tapash Baisya, Mohammad Rafique, Mashrafe Mortaza
Bowling: Shoaib Akhtar 15-6-38-1, Umar Gul 9-1-27-0 (nb-1), Danish Kaneria 18-3-50-0 (nb-1), Shabbir Ahmed 11-1-33-1, Mohammad Hafeez 12-7-9-1