Then, having been asked to follow on, Glamorgan lost six second innings wickets for 120, meaning they still need another 135 runs to avoid an innings defeat.
Left-arm spinner Kartik made Glamorgan batsmen dance to his tunes, taking his six wickets in just 63 deliveries and conceding 10 runs as the visitors lost their last seven wickets for just 28.
Earlier Glamorgan began the day taking the final five Middlesex wickets for just 41 runs in less then 10 overs - with Chaminda Vaas racing to 79 before he became the ninth man out caught at deep square leg.
Tim Murtagh had been run out for two and Kartik soon followed for one, giving Mark Wallace a simple catch behind the stumps.
And the innings was wrapped up when Chris Silverwood holed out to mid-on for five.
Aussie left-hander Jimmy Maher started off well sending the first ball of the innings to fine-leg boundary with an elegant glance but four balls later he padded up to a straight delivery off Silverwood only to be given out LBW.
He was soon followed by Gareth Rees for nought, caught down the leg-side by Ben Scott off an attempted drive.
With the score on 27, David Hemp was next to fall for nine, again edging to the wicket-keeper.
A 51-run partnership between Dan Cherry and Ryan Watkins was broken by Kartik - Watkins (30) was deceived by the turn and was well caught low down at silly mid-on by Billy Godleman.
Cherry was the fifth wicket to fall, trapped leg before wicket for 32, and both Alex Wharf and Wallace steered Glamorgan to 100 before Wallace (11) again offered no stroke from Kartik and was out.
A further three runs were added before Glamorgan lost three wickets without adding a run.
First to go was Wharf (10) surprised by the bounce from Kartik and taken by the wicket-keeper.
Then in his next over, Dean Cosker went without troubling scorer, caught at short leg and Tim Murtagh had Robert Croft fencing to Scott behind the stumps for another duck.
Simon Jones was the last wicket to fall, caught at mid-on for three.
Glamorgans second innings began much the same as the first with Maher falling to the third ball, without scoring.
Rees offered no stroke and was given out lbw having scored eight to leave the visitors on 12 for two and then Cherry gave Alan Richardson his first wicket of the day, driving to third slip for 10.
Glamorgan lost two more wickets in the form of Rees (8) and Cherry (10) before skipper Hemp played a little cameo. He smashed Kartik for two huge sixes on his way to 36. However Kartik had last laugh when he consumed Hemp caught at Mid-on for a mis-timed pull.
Wallace fell for nine, caught at short leg and another five runs had been added when Watkins (20) was beaten by a ball angled across him, giving Scott another catch behind the stumps.
Middlesex Ist innings 361 (Vaas 79, Compton 67, Scott 65, Ed Joyce 51; Wharf 4 for 77, Cosker 3 for 62, Waters 2 for 73) Vs Glamorgan Ist innings 106 ( Cherry 32, Watkins 30; Murali Kartik 6 for 21, Silverwood 2 for 42) and 120 for 6.