The 18-year-old took four wickets on the third morning as Middlesex collapsed from 249-5 to 293 all out, to trail by 122 runs on first innings.
Toby Roland-Jones then struck three times, dismissing both Zafar Ansari and Aaron Finch for ducks, to help drag the hosts back into the match.
But Curran's career-best 71 not out saw Surrey to a lead of 356, on 234-6.
During a chaotic morning, Curran started the rot by bowling James Franklin in the third over as Middlesex lost their final five wickets for just 44 runs.
Surrey reached 47 without loss with relative ease but, when Roland-Jones bowled Rory Burns (39), the visitors lost their next three wickets without adding a run.
James Harris had fellow Middlesex opener Dominic Sibley caught behind off the next over before Roland-Jones returned to trap Ansari and Finch lbw, leaving the visitors 47-4.
After Jason Roy made an attacking 37, spinner Ollie Rayner bowled the England limited-over batsman, then removed Steven Davies (20) to swing the match in the host's favour.
But an unbroken 126-run seventh-wicket stand between Curran and wicketkeeper Ben Foakes (50 not out) left Surrey firmly in control.
Middlesex head coach Richard Scott said:
"It sort of ebbed and flowed today. We didn't create the partnerships that we needed at the end of our innings.
"But, then we bowled really well in that middle session and took quick wickets. At one stage, we looked like we might bowl them out and set up a chase.
"But, Curran and Foakes batted really well and frustrated us and it clearly shows on this pitch when you get a partnership going, it's hard to get people out.
Surrey batsman Ben Foakes told BBC Radio London:
"It's a very good day for us. There was a stage in the middle where it didn't quite go to plan, but Sam (Curran) batted really well and I stuck with him.
"I think we're in a good position in the game and hopefully we can drive it home tomorrow.
"Sam bowled really beautifully at the start of the day and to take four quick wickets on this wicket is I think really difficult.
"To be able to blast them out was perfect for us and allows us to boss the game."
Sam Curran starred with bat and ball to help put Surrey in a commanding position against Middlesex at Lord's.