Australia's most prolific offspinner continued to ask questions of the Pakistani openers but Holland made a nervous start to his Test return, going for eight off his first over and conceding an Imam six over midwicket in his fourth over.
All up, Khawaja spent nearly 13 hours at the crease with temperatures in the high 30s.
Prepare for a summer of cricket like you've never seen before. However, Paine admitted he was nervous in the final minutes of the Test.
Another loose shot from Hafeez the following over gave Australia some hope but the 37-year-old settled and brought up his century shortly before tea.
Khawaja was swiftly followed back into the pavilion by Starc and Siddle - Starc out to a superb one-handed grab from Babar Azam at short leg and Siddle trapped leg before - but Paine and Lyon batted out a further 12 overs and one delivery before Sarfraz called for handshakes.
"Pakistan played very well and had us under the pump for three days", Paine said at the post match presentation ceremony.
Pakistan had beaten Australia 2-0 in their last Test series in the UAE in 2014.
PlayStation will FINALLY let you change your PSN name
Sony is rolling out name change functionality first as a beta that will only be available through the PlayStation Preview Program. Some PlayStation 4 games released before April 1, 2018 and all published after that date will support the feature.
Imam's injury has come at a wrong time for Pakistan as he was looking in good form.
The unassuming batsman was caught behind off part-time spinner Marnus Labuschagne.
VideoCricket, the sport of the nation can be found this summer on the screens of 7.
Khawaja, who was named man-of-the-match for his efforts, said it was a special feeling to win score hundreds for Australia.
Australia were given an early reprieve on Thursday courtesy of a shocking umpiring call when Head was trapped in front on 44 by Yasir.
Abbas has figures of 3-26 to add to his four wickets in the first innings, but leg-spinner Yasir Shah was still wicketless in the match.
Khawaja survived a run-out scare after reaching his century and was also dropped in the slips of Yasir's bowling late on day four.