Durham 106 for 1 (Lees 65*) trail Yorkshire 340 (Lyth 111, Thompson 54) by 234 runs
Lyth made his way from 75 not out overnight to 111 off 188 balls before fellow left-hander Lees dominated after tea with 65 not out in Durham's reply of 106 for 1 from 33 overs.
The pair won two Championship titles together for Yorkshire in 2014 and 2015 before Lees fell out of form and left his home county for Durham to reignite his career in 2018.
He has since played Test cricket for England and is currently on a run of four hundreds in his last five Championship innings. Number five could follow on day three.
Lees, 30, is the only player to have topped 1,000 runs in either division of the Championship this season, while Lyth is now inside the top 10 scorers in Division Two with 757.
As Yorkshire advanced from 142 for 2 overnight, new-ball pair Matthew Potts and Ben Raine finished with 4 for 111 and 4 for 93 respectively. Raine claimed three of his wickets on day two.
Lyth just loves batting at North Marine Road. Having grown up in Whitby, he learnt his craft on this ground, playing for the juniors and the seniors. He last played league cricket for them 10 years ago this coming September. Such is his fondness for Scarborough that he once went to Perth in Western Australia to play a winter of grade cricket for a coastal club of the same name.
Lyth drove particularly well, especially on day one, and brought up his century off 157 balls.
Durham clearly had more success with the ball during day two, claiming eight wickets. But they will have been frustrated at dropping a couple of slip catches, and Yorkshire will have been delighted with their work having been inserted.
Just when it looked like Durham had created an opening, the lower order frustrated them.
Raine trapped Ryan Rickelton lbw as Yorkshire reached an early lunch on 211 for 3, with rain preventing play between 12.35pm and 2pm. He then had Lyth caught behind cutting before wicketkeeper Ollie Robinson also helped Potts remove Matthew Revis, but at the second attempt after steepling bounce.
And when Jonny Tattersall dragged a pull at Bas de Leede onto his stumps, Yorkshire were 236 for 6 in the 69th over having lost three wickets for 24.
But a trio of handy contributions, led by Thompson, helped Yorkshire reassert their authority as another 104 runs were added.
Ben Coad made 19 and Matthew Fisher 24, ably supporting Thompson's freewheeling innings. He crashed four leg-side sixes off de Leede and Raine, one of them going out of the ground into the gardens surrounding this venue.
Thompson was the last wicket to fall, caught at long-leg on the stroke of tea pulling against Potts.
In truth, neither bowling performance has been anything to write home about, and we could now be set for the first Championship draw played at Scarborough since June 2013.
Lees is doing everything he can to add to the 10 Test Matches he played last year. He hit all of his first seven boundaries down the ground or through cover off front and back foot, added to a lofted straight six off Coad's seamers.
Having lost opening partner Michael Jones caught behind off Thompson, leaving the score at 42 for 1 in the 10th over, he went on to reach his latest fifty off 64 balls. He shared an unbroken 64 for the second-wicket with captain Scott Borthwick, who will begin day three unbeaten on 29.