Off-spinner Sajid Khan claimed 4-86 and finished with a match haul of 12 wickets as Pakistan defied fading light to beat Bangladesh by an innings and eight runs and take the two-Test series 2-0 in Dhaka on Wednesday.
All-rounder Shakib Al Hasan let Bangladesh's middle order in a brave resistance but could not salvage a draw as the hosts' last wicket fell just minutes before sunset.
Shakib top-scored for Bangladesh with 63 off 130 balls and in the process made an all-round career double of 4,000 runs and 200 wickets, the quickest in history and beating a record long held by Ian Botham.
But despite a 51-run partnership with Mehidy Hossain for the seventh wicket, Bangladesh's hopes were dashed when Pakistan skipper Babar Azam trapped his teammate.
"I felt that I needed to bowl at that stage and really happy I got that wicket," said Babar of his maiden Test wicket.
"Our batsmen and especially openers gave us a good start and our mindset was just to dominate despite the bad weather," he added.
Sajid, who took 8-42 in the first innings, broke through the defence of Shakib in the next over to bowl him out.
He also took the final two wickets when the light started dimming, which prevented Pakistan's fast bowlers from bowling at the tail-enders.
Mushfqur Rahim and Liton Das earlier scored 48 and 45 runs respectively for Bangladesh, but two wickets apiece from Hasan Ali and Shaheen Afridi held the side to 25-4 after Pakistan forced the follow-on.
Mushfiqur made decent partnerships with Liton and Shakib before he was run out on the stroke of tea.
"In the second innings we had an opportunity to play better than the first," said Bangladesh captain Monimul Haque.
"Though some of our senior players played well, we couldn't hang on."
The hosts could only add another 11 runs to their first innings total after resuming with three wickets remaining to get dismissed for 87, their lowest score on home soil and 213 behind Pakistan.
Sajid struck in his first over of the morning to trap Taijul Islam leg before for a duck before Afridi bowled Khaled Ahmed for none in the next over.
Shakib Al Hasan was the last man dismissed when he holed out a catch to Azhar Ali at short cover off Sajid after making 33 runs, the highest in Bangladesh innings.
Only 63.2 overs of play were possible in the first three days because of rain and bad light.
Pakistan declared their first innings with 300-4.
Pakistan won the first Test in Chittagong by eight wickets.
They finished the tour unbeaten, having won the preceding three-match Twent20 series 3-0.