At lunch on the final day on Thursday, Australia were 290-7, needing another 17 to win with three wickets in hand. Captain Ricky Ponting was on 103 and Jason Gillespie on two.
Ponting's watchful vigil took Australia close to their target, but not before he survived a chance on 97 when Mashrafe Mortaza failed to latch on to a catch at long-leg off paceman Shahadat Hossain.
Ponting reached his 31st Test century with a drive through the covers off Mortaza in the next over. He has so far faced 233 deliveries and hit 10 boundaries.
Earlier, left-arm spinner Rafique bowled dangerous left-hander Adam Gilchrist for 12 and trapped Shane Warne leg-before for five as the visitors found the proposition of chasing 95 on the last day a stiff task.
Paceman Mortaza then induced an edge from Brett Lee (29) with the second new ball after the batsman had hit three fours and a six in his useful 74-ball knock.
Rafique, who took a five-wicket haul in the first innings, continued to torment the batsmen with an immaculate line to pick up four wickets in the second innings.