Lawrence, aged 17 years and 290 days, reached three figures from 146 balls with a boundary off Zafar Ansari.
Media playback is not supported on this device
He was eventually caught behind after lunch off left-arm spinner Ansari for 161, having hit two sixes and 17 fours.
Essex declared at tea on 610-8, a lead of 270, and Surrey were 95-2 in their second innings at the close.
Only two players younger than Lawrence, who left school last summer to concentrate on cricket, have scored a Championship hundred - and he is the youngest to do so at The Oval.
Kent's Godfrey Bryan made his first Championship hundred in 1920 aged 17 years and 245 days, and Dipak Patel made a century for Worcestershire in 1976, aged 17 years and 270 days.
Lawrence, who was dropped on 18 during the second day's play, shared partnerships of 68 and 121 with Essex skipper James Foster (23) and Jesse Ryder (57).
And he even faced five deliveries before lunch from Kevin Pietersen, who was pressed into service with his off-spin as Surrey tried to tempt the teenager into an error.
He finally departed when he deflected a ball from Ansari into the gloves of wicketkeeper Gary Wilson, but the home attack then came in for severe punishment from Graham Napier and Greg Smith, who added 116 for the eighth wicket.
The declaration came at tea after Napier was caught off Jason Roy, having struck three sixes and nine fours in his 73 off 62 balls, leaving Smith unbeaten on 50.
Surrey could ill afford the immediate loss of Ansari, who was run out for nought, but the pitch remained benign and Kumar Sangakkara (43) and Rory Burns added 76 before Napier claimed the prized wicket of the Sri Lankan, who edged to Nick Browne at first slip.
Pietersen kept Burns (41 not out) company for the for the final eight and a half overs, making just eight from 26 balls as the home side reached stumps requiring another 175 to avoid an innings defeat.
Essex centurion Dan Lawrence:
"I went to Australia last winter, which was a great experience, and now I'm getting my chance with Essex.
"When I hit the cover drive off Ansari on 96, I knew it was going for four and I could start celebrating. It was a great feeling. I've had quite a few messages already, especially from my old school friends.
"I don't have many heroes in the game, but I suppose AB de Villiers would be my favourite batsman.
"At Essex we have some great players too - like Alastair Cook, Ravi Bopara and Jesse Ryder - and they have all been fantastic to me.
"All the coaches at Essex have been great, and the bowlers like David Masters and Graham Napier have also helped me a lot by telling me how they would look to get me out and things like that. It really helps to know how they think."
BBC London 94.9's Mark Church:
"A day that Dan Lawrence won't forget in a hurry. It was a mighty fine effort and and it put Surrey under pressure.
"Zafar Ansari took four wickets on the day he got his first call up to the England ODI squad, but he was then run out without scoring.
"Kumar Sangakkara looked assured as one would expect and the cool head of Rory Burns, alongside Kevin Pietersen, saw Surrey through to stumps."

The 25-year-old joined Saints from Huddersfield Giants in 2013 and was contracted until the end of 2017.
Former Castleford back Dawson, who operates mainly at winger or centre, scored 16 times in 70 outings.
"Matty is at a time in his career when he needs to be playing regularly," said Saints chief executive Mike Rush.
"Therefore when the opportunity for him to move to Leigh came up it made sense for the both player and the club to agree to the transfer."
Dan Lawrence became the third youngest batsmen to score a County Championship century on day three of Essex's game against Surrey at The Oval.
[NEXT_CONCEPT]
Championship winners Leigh Centurions have signed St Helens utility back Matty Dawson for a five-figure transfer fee on a two-and-a-half-year deal.