Saeed Ajmal also claimed two wickets for the visitors, conceding 64 runs.
Cheema finished with 3-73, while Gul claimed 3-102.
Shakib Al Hasan smashed 144 runs to lead Bangladesh before being run out by Taufeeq Umar in the second session.
Shakib added 82 runs with partner Mushfiqur Rahim in a sixth-wicket stand on Sunday, a day after he and Shahriar Nafees tallied 180 - Bangladesh's first century partnership in tests in more than a year.
Immediately after Shakib's dismissal, Rahim lost his concentration and nipped a length delivery from Gul outside leg stump that was caught by Adnan Akmal.
Bangladesh then quickly lost the remaining wickets, adding only 33 runs.
Pakistan leads the two-test series 1-0 after the visitors beat Bangladesh by an innings and 184 runs in the first test in Chittagong.