Bangladeshi left-arm spinner Shakib Al Hasan finished with 6-82 as Pakistan were bowled out for 470 in their first innings before tea in reply to the hosts' 338.
Shakib, who smashed a career-best 144 in the first innings, became the first Bangladeshi to score a century and take five or more wickets in a Test.