Abid and Abdullah Shafique put on a 151-run partnership for the first wicket, their second consecutive 100-plus stand in the match to give Pakistan's chase a powerful start.Abid, who hit 133 in the first innings, struck 12 boundaries and scored 91 off 148 deliveries in the second innings.
Resuming Day 5 at 109 without loss, and just 93 runs away from the victory, Pakistan's openers appeared to be in full control until offspinner Mehidy Hasan struck.
Shafique followed his first-innings half-century to reach 73 before Mehidy (1-59) trapped him lbw.
Seven overs later, left-arm spinner Taijul Islam (1-89) had Abid out lbw, baffling him with a sharp turn to make Pakistan 171-2.
Azhar Ali then combined with captain Babar Azam to complete the inevitable, hitting consecutive boundaries off Mehidy to finish off the game. Azhar was unbeaten on 24 and Azam was not out on 13.
Liton Das' maiden test century helped Bangladesh post 330 in its first innings, then Taijul Islam claimed 7-116 to bowl out Pakistan for 286 — giving the hosts a 44-run first innings lead.
Fast bowler Shaheen Shah Afridi was instrumental in Pakistan's rally, returned figures of 5-32 to wrap up Bangladesh's second innings for 157.
The second test starts Saturday in Dhaka.