Stevie Eskinazi (66) and Dawid Malan (60) put on 124 for the third wicket and Paul Stirling (77) hit five sixes to help Middlesex recover from 2-2.
But Simon Harmer (5-77) was the catalyst as the visitors slipped from 219-5 to 246 all out inside 60 overs.
Essex closed on 106-0, trailing by 140 runs, as Cook (64 not out) passed 500 Championship runs for the season.
Cook, who is set to play for England in the first Test against South Africa next week for the first time since relinquishing the captaincy, led the opening partnership, with fellow opener Nick Browne ending the day unbeaten on 40.
Essex, who are yet to lose in the four-day game this season, were in control for much of the first day of the first day-night Championship encounter to be held at the County Ground.
The visitors lost Nick Gubbins for a nine-ball duck to debutant Mohammad Amir (2-53) and Nick Compton for two to Jamie Porter (2-58) inside the first three overs.
Malan, who scored 78 on his England debut in Sunday's T20 19-run victory over South Africa in Cardiff, led the Middlesex recovery and the visitors briefly looked in a good position on 126-2.
But Malan's dismissal saw three wickets fall for the addition of 32 runs and the visitors were grateful to Stirling's 50-ball 77 to see them past 200.
South African Harmer's third five-for in successive innings, following his 14-wicket haul against Warwickshire, helped Middlesex to within four runs of a second batting bonus point.
Essex spinner Simon Harmer told BBC Radio Essex:
"The seam is a little bit different. It didn't spin or turn as consistently as I thought it would, which may be played to my advantage.
"There was a lot of bounce with the pink ball and it comes off the bat a lot better. All the bowlers felt there was extra bounce with it. We could have done better with the new ball, but it's going to take time to adjust.
"If I hadn't dropped Stirling, Mohammad Amir would have cleaned up the tail pretty quickly. He was in a nice rhythm. Five wickets went into my column that probably should have been his.
Middlesx's Paul Stirling told BBC Radio London:
"We expected it to swing for a lot longer than it did and, from what we've practised with, and what the lads have experienced in the Abu Dhabi pink ball games.
"We thought it would have done a lot more towards the end of the day as well, but it's done less than we thought. Harmer has been bowling well so he was going to be tricky on a pretty dry pitch.
"Combating him was going to be one of the tougher asks to do and we didn't quite get it right. He was getting a lot of bounce especially from the River End. When he gets a few revs on the ball you feel it can turn. "
England opener Alastair Cook scored a half-century as Division One leaders Essex dominated Middlesex on day one.