The tourists finally enjoyed a successful day on an otherwise miserable tour, where they were whitewashed 3-0 in the one-day series and lost to Bangladesh for the first time in a Twenty20 international
Hafeez made 137 not out, his eighth Test hundred and the third in his last four innings, after Pakistan had ended Bangladesh's hopes of posting a mammoth first innings total.
Hafeez has so far hit 12 fours and two sixes after surviving a narrow escape in the fourth over of the innings when TV umpire Paul Reiffel overturned a decision for a catch at the wicket off Taijul Islam.
Left-handed Aslam, who captained Pakistan's under-19 team before making the grade at senior level, was caught down the leg-side by wicket-keeper Mushfiqur Rahim off Taijul.
Also Read
Azhar survived two dropped catches by Rahim to remain unbeaten at stumps on 65, reaching his half-century with a six off Shakib Al Hasan.
The hosts suffered a blow when Rahim was forced to leave the field after tea with a bruised finger, leaving Imrul Kayes to don the gloves as Tamim Iqbal took over the captaincy.
Left-arm seamer Wahab Riaz and leg-spinner Yasir Shah claimed three wickets each, while Hafeez and Zulfiqar Babar took two each.
Yasir grabbed two of the four wickets that fell in the morning session as Bangladesh faltered against steady spin bowling by the Pakistanis.