Ali made 87 and Broad an unbeaten 57 -- his first Test fifty in four years -- as England piled up 458 all out in their first innings.
The pair then shared four wickets between them to reduce South Africa to 104 for four, with Ali completing the Test all-rounder's double of 2,000 runs and 100 wickets by striking twice with his off-spin.
England vs South Africa - 1st Test, Day 2: As It Happened
Temba Bavuma (48 not out) and Theunis de Bruyn (48) realised crease occupation alone would not get South Africa out of the hole they were in.
ALSO READ: England vs South Africa: Moeen Ali Completes All-rounder Test Double
But de Bruyn, only playing because regular captain Faf du Plessis was on 'paternity leave', fell for 48 shortly before the close and at stumps the Proteas were 214 for five -- still 244 runs behind in the first of this four-Test series.
"It's a great feeling to do it on the same day at Lord's," Ali told Sky Sports when asked about completing both halves of the double on Friday.
"I'm still inconsistent -- I know that - but I was really happy with the way I bowled today," added Ali, who took an economical two for 35 in 13 overs.
England resumed on 357 for five, with Joe Root 184 not out in his first Test as England captain.
Ali was 61 not out and just 12 runs away from reaching 2,000 in Tests.
England twice lost two wickets for no runs in three balls on Friday yet passed 450 thanks to an entertaining last-wicket stand of 45 between Broad and James Anderson.
Root had made the most of being missed several times on Thursday to lead an England recovery after the hosts had been in trouble at 76 for four.
But the first chance he gave on Friday brought about his downfall on 190 -- the highest score by an England captain in his first Test in charge, surpassing Alastair Cook's 173 against Bangladesh in 2010.
There was no reprieve when the 26-year-old Yorkshireman was caught behind off fast bowler Morne Morkel -- denied a wicket Thursday by a no-ball -- as he fell just 10 runs shy of his second Test double hundred at Lord's.
Root walked off to a standing ovation from a capacity and sun-drenched crowd, having batted for over six hours, facing 234 balls including 27 fours and a six.
The first over after the drinks break again saw England lose two wickets, with Ali out in sight of a sixth Test century when bowled trying to drive Kagiso Rabada.
- Broad Hits Out -
But an undaunted Broad, who made his Test-best 169 against Pakistan at Lord's in 2010, struck shots worthy of his father Chris, the former England opener.
He pulled Morkel for two sixes in as many balls to complete a dashing 45-ball fifty.
It was Broad's most fluent Test innings since he was hit in the face by a Varun Aaron bouncer against India at Old Trafford in 2014.
No 11 Anderson then pulled Rabada for six to bring up England's 450 before he was caught behind off Morkel (four for 115 in 25.3 overs).
South Africa's Dean Elgar was, like Root, captaining in a Test for the first time.
After the early loss of debutant opening partner Heino Kuhn, he too tried to lead from the front with a typically gritty fifty.
But Hashim Amla, so often a thorn in England's side, was dismissed for just 29 when lbw to a sharply turning off-break from Ali.
"I've never got him out in a Test before and I'm really happy with that," Ali said.
After tea, Elgar fell for his interval score of 54 when caught by Gary Ballance at short leg as Ali, in his 38th match at this level, became the fifth-quickest player in Test history to do the 'double'.
South Africa's 98 for three then became 105 for four when JP Duminy (15) was plumb lbw to Broad.
Bavuma and de Bruyn undid some of the damage until the latter was caught behind after carelessly pushing away from his body at Anderson.
Dean ElgarEngland vs South Africa 2017England vs South Africa HighlightsJoe RootLord's Test HighlightsMoeen Alistuart broadtemba bavuma
First Published: July 8, 2017, 1:07 AM IST