Middlesex finished Day Two with a lead of 402 runs, after bowling Glamorgan out for 171 & hitting 189/5 in reply.