Left-arm spinner Abdur Rehman broke through Bangladesh's resistance before Pakistan raced against fading light to complete a seven-wicket win on the final day of the second cricket Test on Wednesday.
Set a winning score of 103, Pakistan had no choice but to try to score quickly to claim a 2-0 series win, playing most of the final two sessions on the fifth day under floodlights.
Opener Mohammad Hafeez led Pakistan's victory charge with 47 off 52 balls before his attempted slog off Shakib Al Hasan ended at long-on fielder Shahadat Hossain.
He added 63 runs with Azhar Ali for the second wicket after first innings centurion Taufiq Umar was dismissed for three when he lofted a catch to Nazimuddin at midwicket off Nazmul Hossain.
Azhar was last man out when left-arm Elias Sunny bowled him for 34 off 43 balls with Pakistan two runs away from a win.
Misbah-ul Haq completed the win with a six as Pakistan raced to 107 runs in 20.5 overs amid fears that the umpire might stop play for bad light.
The hosts were looking comfortable after a delayed start due to fog before Rehman revived Pakistan's hopes by ending a dogged 117-run sixth-wicket stand between Nasir Hossain and Mushfiqur Rahim to finish with career-best figures of 4-51.
Saeed Ajmal then claimed the final two wickets to complete a typical Bangladesh collapse.
The home side resumed after lunch on 200-5 but lost their last five wickets for 34 to be bowled out in their second innings with an hour remaining before the tea interval.
Rehman bowled Nasir for 79 runs before he had Rahim caught by Ajmal at mid-off for 53 as Bangladesh crumbled after surviving the morning session unscathed.
Nasir struck 11 fours for his maiden Test fifty while Rahim hit seven fours.
Younus Khan took a brilliant catch at first slip to send back the next batsman Shahadat off Rehman and Ajmal soon bowled Sunny for four and dragged last man Robiul Islam out of the crease for a stumping to end the innings.
Scorecard
Bangladesh (1st innings): 338 (Shakib Al Hasan 144, Shahriar Nafees 97)
Pakistan (1st innings): 470 (Taufiq Umar 130, Misbah-ul-Haq 70, Azha Ali 57, Adnan Akmal 53; Shakib Al Hasan 6-82).
Bangladesh (2nd innings): (overnight 114-5)
Tamim Iqbal c Misbah b Umar Gul 21
Nazimuddin b Abdur Rehman 12
Shahriar Nafees lbw b Umar Gul 0
Mahmudullah c Rehman b Aizaz Cheema 32
Nasir Hossain b Abdur Rehman 79
Shakib Al Hasan c Azhar b Aizaz Cheema 6
Mushfiqur Rahim c Ajmal b Abdur Rehman 53
Elias Sunny b Saeed Ajmal 4
Shahadat Hossain c Younus b Abdur Rehman 1
Nazmul Hossain not out 8
Robiul Islam st Adnan b Saeed Ajmal 0
Extras: (b-9 lb-8 w-1) 18
Total: (in 82.1 overs) 234
Fall of wickets: 1-24, 2-24, 3-54, 4-76, 5-95, 6-212, 7-221, 8-226, 9-228, 10-234.
Bowling: Umar Gul 13-4-34-2 (w-1), Aizaz Cheema 15-2-61-2, Abdur Rehman 27-12-51-4, Saeed Ajmal 23.1-6-56-2, Mohammad Hafeez 3-0-8-0, Azhar Ali 1-0-8-0.
Pakistan (2nd innings):
Mohammad Hafeez c Shahadat b Shakib Al Hasan 47
Taufiq Umar c Nazimuddin b Nazmul Hossain 3
Azhar Ali b Elias Sunny 34
Younus Khan not out 16
Misbah-ul-Haq not out 6
Extras: (nb-1) 1
Total: (for three wickets; 20.5 overs) 107
Fall of wickets: 1-7, 2-70, 3-101
Did not bat: Asad Shafiq, Adnan Akmal, Abdur Rehman, Umar Gul, Saeed Ajmal, Aizaz Cheema.
Bowling: Nazmul Hossain 5-1-19-1, Shakib Al Hasan 10-1-47-1, Shahadat Hossain 4-0-26-0 (nb-1), Robiul Islam 1-0-8-0, Elias Sunny 0.5-0-7-1.
Result: Pakistan won by seven wickets.
Pakistan won the two-match series 2-0.