England were 269 for six at lunch, with Stokes 64 not out and Moeen Ali unbeaten on 10.
Stokes shared stands of 63 and 75 with Cook and Jonny Bairstow respectively as England capitalised on Vernon Philander's prolonged absence during another overcast morning that should have suited the key paceman.
Philander had enjoyed a superb return of two for 17 in 12 overs in between bouts of stomach illness on Thursday's rain- marred first day.
England had been criticised by several former captains for some slap-dash batting in a huge 340-run defeat by South Africa at Trent Bridge that saw the Proteas level this four- match series at 1-1.
But Stokes, in the 100th Test at The Oval, got the balance right on Friday morning, the all-rounder aggressive against the old ball and watchful when the new one arrived.
England resumed on 171 for four, with Cook 82 not out and Stokes 21 not out.
Cook, however, had added just six runs to his score when he was lbw to fast bowler Morne Morkel for 88, made in a near five-hour innings that saw the former skipper face 200 balls and hitting 10 fours.
Cook was in sight of his 31st Test century when he played back to the towering Morkel, bowling from around the wicket.
The left-handed opener reviewed West Indian umpire Joel Wilson's decision but replays showed the ball clipping the top of the stumps.
But left-handed batsman, who made a Test-best 258 against South Africa at Cape Town last year, dismissively pulled Morkel for four.
Meanwhile Bairstow struck three boundaries off left-arm spinner Keshav Maharaj's first over of the day, two sweeps separated by a drive.
But the new ball did the trick for the Proteas when Bairstow, on 36, edged a lifting Rabada delivery to second slip, where South Africa captain Faf du Plessis held a sharp catch.
Disclaimer: No Business Standard Journalist was involved in creation of this content
