Dublin: Pakistan seized control in Malahide as they closed day three with a 116-run lead over Test debutants Ireland.
Ireland were reduced to 7-4 in reply to Pakistan's 310-9 declared but they recovered thanks to Kevin O'Brien's 40 and an unbeaten 33 from Gary Wilson.
Mohammad Abbas took 4-44 as Ireland were bowled out for 130.
Pakistan enforced the follow-on but openers Ed Joyce (39) and William Porterfield (23) gave Ireland hope by moving to 64-0 at stumps.
The Irish duo were fortunate to reach the close of play, with both dropped off Mohammad Amir.
Joyce, out for four in the first innings, was on nought when he edged Amir low to the left of wicket-keeper Sarfraz Ahmed, with the diving Pakistan captain unable to cling on to the chance.
And Porterfield had made just three when Azhar Ali made a mess of a routine catch at third slip.
Former England one-day international Joyce, at 39 the oldest Test debutant since Australia's Bryce McGain made his bow aged 36 in 2009, cashed in with some elegant shots including a cover-driven boundary off Abbas.
The paceman took four wickets as Ireland's first innings was wrapped up inside 48 overs.
Abbas struck twice in a 30-minute spell before lunch to leave Ireland 5-3 after Sarfraz's well-timed declaration.
Ireland were in danger of marking their debut with the lowest completed innings total by any side in the 141-year history of Test cricket -- New Zealand's 26 against England at Auckland in 1955.
But Kevin O'Brien's belligerent 40 spared them that embarrassment while Wilson, who injured his arm batting in the nets and so came in down the order, made 33 not out to help ensure South Africa's 84 against England at Port Elizabeth in 1889 remained the lowest total by a side in their maiden Test innings.
Porterfield then fell for one when Amir uprooted his off-stump with what became the last ball before lunch.
Leg-spinner Shadab Khan continued his fine all-round display by taking two wickets in three balls to leave Ireland 61-7.
And when he had last man Tim Murtagh caught at short leg, Ireland were 31 runs shy of the follow-on avoidance target of 161.
They needed to be within 150 runs of Pakistan, rather than the usual 200, after rain had washed out the whole of Friday's first day.