Middlesex's hopes of a first County Championship title since 1993 suffered a potentially fatal blow as Somerset claimed 12 wickets on day two at Lord's.