Anuj Dal hit a career-best 92 and Leus du Plooy made his first red ball century for Derbyshire in another strong batting day at The Pattonair County Ground.
The pair added 133 for the fifth wicket before Derbyshire declared on 557-6 shortly after lunch on Day Two.
Luis Reece struck twice with the ball as Middlesex closed on 135-3, still trailing by 422 heading into the third day.
The East Midlands Rivalry! Guarantee your tickets today for the big Vitality Blast clash against Notts Outlaws on Friday 26 July. Buy online or call 01332 388 101.