Resuming their first innings on 100-4, 55 runs behind Afghanistan's opening effort, Ireland's middle and lower order dragged them to 263 all out and a 108-run lead
Ireland put themselves in a strong position to claim their first Test victory at the eighth attempt despite a late fightback from Afghanistan on day two of their one-off Test in Abu Dhabi on Thursday.
Resuming their first innings on 100-4, 55 runs behind Afghanistan's opening effort, Ireland's middle and lower order dragged them to 263 all out and a 108-run lead.
When Afghanistan were reduced to 38-2 a two-day finish looked possible, but despite losing Noor Ali Zadran for 32, an unbroken 41-run stand between captain Hashmatullah Shahidi and Rahmanullah Gurbaz took the nominal hosts to 134-3.
"There was pressure but I kept it calm and simple... Because as a captain you have to lead by example," Shahidi said after ending the day 53 not out, his second Test fifty.
"Last two Tests my performance was not good but today I felt good... Tomorrow is a big day for us. We have to win the first session to be in the mix."
Any first-innings lead for Ireland looked a way off when Harry Tector was dismissed by Naveed Zadran to leave them 106-5.
But Paul Stirling made 52, putting on 80 runs with wicket-keeper Lorcan Tucker, who later fell to Zia-ur-Rehman Akbar for 46.
A useful 38, though, from Andy McBrine, who was last man out, put Ireland in a strong position.
Left-arm spinner Akbar finished with 5-64 from his 30 overs.
Irish seamer Mark Adair followed up his first-innings five-wicket haul by taking the crucial wickets of Ibrahim Zadran and Rahmat Shah.
Ibrahim Zadran was brilliantly taken in the gully by Peter Moor before Shah nicked behind to Tucker.
Noor Ali Zadran and Shahidi rebuilt steadily before the veteran opener was bounced out by Barry McCarthy.
But Rahmanullah, making his Test debut, counter-attacked, hitting two sixes in his unbeaten 23.
Afghanistan, who like Ireland played their first Test in 2018, will be hopeful of notching their fourth victory in the format if they can set the tourists a testing run chase on a pitch already showing signs of significant turn.