England captain Ben Stokes had bowled his side back into the game when he removed well-set opener Erwee (73) and Rassie van der Dussen (19) in quick succession to leave the Proteas 192-5.
But come stumps on the second day South Africa were 289-7 — 124 runs ahead.
Jansen was 41 not out, having added 72 in just 75 balls for the seventh wicket with Maharaj (41) as they punished England’s failure to bowl to increasingly unorthodox fields.
South Africa had earlier dismissed England for just 165, with fast bowler Kagiso Rabada taking 5-52 — his 12th five-wicket haul in a Test innings but first at Lord’s.
🚫 DAY 2 | STUMPSA 72-run 7th-wicket partnership between Maharaj (41) and Jansen (41*) frustrated the hosts after… https://t.co/TMwjCjH2O7
— Cricket South Africa (@OfficialCSA) 1660845845000
“We’ve got a bit of momentum with that partnership at the back end and one of our bowlers getting a ‘five-for’,” Erwee told reporters.
“If we rock up tomorrow with the same energy we’ll stay ahead of the game, I’m sure.”
As for his own innings, the 32-year-old left-hander, appearing in just his fifth Test, said: “There are times you look around and think, it (Lord’s) is ‘the Home of Cricket‘, a special place. But I try to control my thoughts as much as possible.”
Ollie Pope’s 73 was the only double-figure score by a specialist England batsman, with all-rounder Stokes’s 20 the next-best contribution.
“Obviously we are behind in the game, but we stuck at it very well,” England left-arm spinner Jack Leach told Sky Sports.
As for Jansen and Maharaj’s stand, he added: “It’s the way it goes. We’re always trying to play without the scoreboard and do the right things.”
Thursday’s largely sunny conditions undoubtedly made batting easier than it had been on Wednesday’s rain-shortened first day.
But South Africa captain Dean Elgar and fellow left-hander Erwee still showed plenty of application while also scoring briskly against an England attack that lacked both the pace and accuracy of the Proteas’ four quicks.
Elgar, dropped on seven by Zak Crawley in the slips, was then largely untroubled until, having made 47, he fell in freak fashion when a ball from 40-year-old England great James Anderson deflected off his thigh guard and forearm before trickling onto the stumps.
Erwee reached just his second Test fifty when he struck Stuart Broad through the covers for a sixth four in 89 balls faced.
Aiden Markram hit three fours in his 16 before he was caught behind off Leach — the first spinner used by either side this match.
South Africa were still well-placed when Stokes took two wickets for five runs in seven balls en route to stumps figures of 3-53 in 12 overs.
Giving everything for his team 💪This spell 🙌🏴 #ENGvSA 🇿🇦 https://t.co/5DybnwEYeY
— England Cricket (@englandcricket) 1660841417000
He dismissed the resolute Erwee when a superb bouncer from around the wicket lifted off a good length to take the glove before lobbing gently to wicketkeeper Ben Foakes.
Stokes, battling a longstanding knee problem, then had van der Dussen plumb lbw for 19.
Stuart Broad then took his 100th Test wicket at Lord’s when Kyle Verreynne (11) edged behind to opposing gloveman Foakes.
Test wicket number 1️⃣0️⃣0️⃣ at Lord’s for Broady! 👏 🏴 #ENGvSA 🇿🇦 | @HomeOfCricket | @StuartBroad8 https://t.co/toFYsPXO6u
— England Cricket (@englandcricket) 1660851019000
Maharaj, however, dismissively pulled Anderson for four and Jansen hooked Stokes for six over long leg.
England resumed Thursday on 116-6, with Pope 61 not out before Rabada wrapped up the innings, having sparked an initial collapse by removing openers Alex Lees and Crawley cheaply on Wednesday.
England have won all four of their Tests under a new leadership pairing of Stokes and coach Brendon McCullum after adopting a policy of all-out attack.
But the approach was found wanting against a quality attack that has helped South Africa climb to the top of the World Test Championship table.
Rabada, had Pope chopping on to a full-length ball to end a 102-ball innings, with England 134-7.
He then deceived Broad with a clever slower ball the tailender spooned to Elgar at point before ending the innings by having Anderson lbw for a duck.