Pakistan grabbed four wickets through their spinners and will push for a win on the fifth and final day for a 1-0 lead in the two-match series.
Chris Rogers was 23 not out and Steven Smith unbeaten on three as Australia need another 379 runs for an unlikely win.
Pakistan declared their second innings at 286-2 after a brilliant 131 from Ahmed Shehzad and 103 not out by Younis Khan.
Younis’s second hundred in the Test made him the seventh Pakistani to score twin centuries in an innings and also set a new record for most hundreds for his country.
Australia had conceded a 151-run lead after being bowled out for 303 in reply to Pakistan’s first innings total of 454.
The second and final Test starts in Abu Dhabi on October 30.-AFP