Murtagh grabbed three wickets, including two in two balls – with Miguel Cummins claiming the other – as Sussex crumbled to 4-4 in their second innings, eventually reaching 33-4 at stumps.
That left the visitors holding an overall advantage of 123 after bowling their hosts out for 203 earlier in the day, with teenage off-spinner Jack Carson returning career-best figures of 4-46.
Carson said: “The seamers set the tone really well – Ollie Rob came out and did what he does and Mitch (Claydon) as well was brilliant. That makes it so much easier for the spinner to come on when there’s pressure already built.
“A lot of it has come from working with Ian Salisbury – he’s been brilliant. I’ve been working with him since last summer and I’ve tried to learn as much as I can. He’s said ‘you’re in the game to take wickets as spinners’ and it’s about what fields you set and making sure those fields match your plans – he’s made that really clear.
“It’s a good wicket – there’s a little bit in it for the seamer but once you get in there are runs to be had and hopefully we’ll be able to get a result.”
Middlesex had slumped to 80-6 before John Simpson, debutant Blake Cullen and Cummins all rallied with the bat to keep their side within striking distance.
Ollie Robinson (2-56) and Mitch Claydon (3-23) soon had Middlesex on the back foot when the home side began their first innings, taking advantage of morning cloud cover to keep the scoring rate to a minimum.
Claydon sent down four consecutive maidens, while Robinson continued his persistent habit of taking Middlesex wickets as he trapped Sam Robson (2) leg before with his fifth ball of the day.
Max Holden and Nick Gubbins dug in to face a testing examination, with Holden scoring just a solitary run from his first 36 balls, but the opener seemed to have all the hard work behind him when he fell to Sussex debutant Will Sheffield.
The teenage left-armer had Holden (7) caught at first slip and Middlesex were in deeper trouble when skipper Stephen Eskinazi (3) was leg before to Robinson in the next over.
Two further lbw decisions went in Sussex’s favour before lunch – both accompanied by a whiff of controversy as Robbie White (7) fell to a ball from Claydon that looked high and wide and Gubbins (26) was given out to a Carson delivery which seemed to be drifting beyond leg stump.
Carson collected his second wicket early in the afternoon session – pinning Martin Andersson plumb lbw on the back foot after a breezy 17 – but Simpson and Cullen dug their side out of a hole with their seventh-wicket stand of 70.
The Middlesex pair went for their shots, particularly Simpson, who rattled off a string of fours – the best of them a straight drive off Delray Rawlins that raised the 50 partnership.
Simpson’s innings of 48 included nine fours overall before he was eventually dismissed by Claydon, bowling him with a quicker delivery that nipped back from outside off stump.
However, Cullen and Cummins maintained the Middlesex recovery with a spirited partnership of 51, either side of an hour’s delay following a downpour during the tea interval.
Cullen batted with a maturity well beyond his 18 years, occupying the crease for almost two and a half hours for a solid 34, while Cummins counter-attacked with three boundaries in his 25.
The pair secured a batting bonus point before Middlesex’s last three wickets tumbled in rapid succession, with Cullen leg before to Claydon and Carson collecting the scalps of Cummins and Murtagh (0) in the space of three deliveries.
That left Sussex to face an awkward period of 12 overs before the close – and Murtagh struck in the third of them, moving the ball back at Phil Salt (1) to bowl him through the gate.
Murtagh then trapped Harry Finch (2) plumb in front of the stumps and had Tom Clark taken at first slip off an outside edge for a first-ball duck before Cummins had Aaron Thomason lbw, also without scoring, in the next over.
The damage could have been even worse for Sussex, had Robson been able to hang on when Ben Brown offered a slip chance off Cummins – but the skipper (9*) and Delray Rawlins (19*) saw their side through to stumps.