A partnership of 91 between Leus du Plooy (90) and Anuj Dal (48) helped Derbyshire to recover from a poor start on Day Two.
Ethan Bamber returned 4-37 and with skipper Tim Murtagh weighing in with four for 60 they reduced the visitors to 201-9, still 81 behind Earlier Robbie White reached 120 in the host’s tally of 282, Sam Conners taking 3-65.
The hosts began on 218-5 with centurion White still at the crease, but once John Simpson edged Anuj Dal to slip to end a stand of 79, a clatter of wickets began.
Toby Roland-Jones hit his first competitive ball since April for four before Dal caught and bowled him and Bamber swept Matt Critchley into the hands of deep square.
White’s long vigil ended when he nicked Conners to slip to give the paceman his third wicket and only a few lusty blows from Thilan Walallawita, including a straight six lifted the hosts beyond 280.
But Bamber had Derbyshire 22 for two by lunch, skipper Billy Godleman slashing loosely to slip, and Tom Wood castled by a peach of a ball which pitched middle and hit off.
The afternoon session was a microcosm of why both sides have struggled this season as Derbyshire’s top order largely got themselves out before Middlesex let them off the hook.
Luis Reece swished loosely to be taken at slip and Critchley’s feet looked stuck in cement as he fell lbw, both to Murtagh who then had Hughes caught from one that bounced off a length.
When Brooke Guest flashed lazily at Martin Andersson the visitors were 76-6 and in danger of being ousted for less than 150 for the ninth time in 13 attempts.
Du Plooy however stood firm and helped by a number of friendly offerings moved to 50 in only 57 balls with 10 fours. He found an ally in Dal (48) who made his highest score of a wretched season.
The pair added 91 either side of the tea break, before Murtagh again made the breakthrough, ending du Plooy’s fine innings via an edge through to the diving Simpson.
Bamber then returned to bowl Dal and have Alex Thomson caught behind before bad light ended play 20 overs early.