Middlesex 42 for 0 trail Somerset 443 for 9 dec (Elgar 158, Gregory 137) by 401 runs
Reigning Specsavers county champions Middlesex appear on course for their fourth successive draw of an uninspired Division One title defence after Somerset enjoyed the best of a sun-kissed second day at Lord's.
In the 22 remaining overs of an extended 104-over day that helped make up for Friday's rain delays, Middlesex went in at stumps to reach the mid-point of the match on 42 without loss - a first innings deficit of 401. Their openers, Nick Compton and Nick Gubbins, endured a stern test to finish unscathed on 19 and 21 respectively.
Somerset were indebted to a record sixth-wicket stand between Elgar and Gregory which rescued their side from the depths of 80 for six to the undoubted riches of four batting bonus points.
Elgar crunched a season-best 158 while Gregory, in hitting 137, sailed past his previous best - an unbeaten 73 scored against Yorkshire at Headingley last season - to post his maiden first-class century in his 78th innings.
The hosts spurned their one and only pre-lunch opportunity whilst gifting a life to Gregory with his score on 31. Fencing at a lifting delivery from Toby Roland-Jones, the right-hander was downed, one-handed at second slip by Ollie Rayner who, moving late to his right, appeared to lose the ball in the backdrop.
Soon afterwards, Gregory rubbed salt in Middlesex wounds by plundering consecutive, cover-driven boundaries against Roland-Jones to move to an attractive 84-ball 50 with 10 fours.
Elgar, the South Africa Test batsman, posted his second century of the season with a straight six against off-spinner Rayner. The left-hander danced down the pitch to deposit one over the Nursery End ropes and reach the milestone from 186 balls and with 15 fours to go with his maximum. It was the 31st first-class hundred of his career and his first at Lord's.
The pair saw off the second new ball and batted on after lunch to take their side beyond 300. In doing so they created a new sixth-wicket record for Somerset against Middlesex, beating the 196 scored by Peter White and Maurice Tremlett at Bath in 1959.
Gregory marched on to secure his maiden first-class hundred with a leg glance against Tom Helm that flew to the ropes in front of the Pavilion. He punched the air, fist-bumped with Elgar and embraced his partner before holding his bat aloft to receive the acclaim for his 186-ball century which included 15 fours.
The duo added 249 before Middlesex bagged their first wicket in 70 overs' play by ending Elgar's six-and-three-quarter-hour vigil. It needed a beauty to do so - a James Franklin leg-cutter from the Nursery End that held its own against the Lord's slope to feather the edge and give John Simpson his fourth catch of the match.
Gregory added a further 47 in tandem with Josh Davey but finally went after 333 minutes at the crease. Aiming to pull a length ball from Roland-Jones, he top-edged to long leg where Tom Helm pocketed the skier. Gregory faced 231 balls for a score that included 17 fours and a six.
Davey muscled a cameo 47 against his former club before top-edging a pull to midwicket to give Helm a second scalp, then Jamie Overton (37) skied to long-on to be caught by 12th man James Harris.
Substituting for Roland-Jones, Harris - who has returned from a second rolling-loan stint with Kent - made good ground running in from the ropes for Rayner's sole wicket of the innings as Somerset declared nine down at 5.10pm. Tim Murtagh, Roland-Jones, Helm and Franklin all claimed two wickets apiece for the weary Middlesex attack.