Maharaj's nine-wicket spree was South Africa's best in an innings since the country's post-apartheid return to Test cricket in 1991.
Keshav Maharaj, who took 9-129 in Sri Lanka's first-innings 338, struck in successive overs to remove Gunathilaka (61) and Dhananjaya de Silva (0).
Those were the only two breakthroughs South Africa could manage, as Sri Lanka's batsmen negotiated testing spells from the opposition quicks and their lone frontline spinner.
Left-arm orthodox spinner Keshav Maharaj claimed the best test innings figures by a South African bowler since the country's readmission to worldwide cricket in the second match against Sri Lanka at Sinhalese Sports Club grounds on Saturday.
Sri Lanka resumed day three on 151 for three, an overall lead of 365 runs against a South African side who have yet to score 150 in the series, and made a decision to allow Angelo Mathews to bat himself into form.
Netanyahu to discuss situation in Syria with Lavrov, Russian general staff chief
Iranian President Hassan Rouhani had on Sunday warned Trump not to "play with the lion's tail", saying that conflict with Iran would be the "mother of all wars".
Tiger Woods angry after Open despite best Major finish in 5 years
All he did at the BMW PGA Championship was go head-to-head with McIlroy in the final round and beat him by two. Woods got up-and-down for par on 17 after his approach spun into the wind, ballooned and fell woefully short.
Johnny Manziel traded from Hamilton to Montreal
Manziel redshirted in 2011 and went on to win the Heisman Trophy the following season under new coach Kevin Sumlin. Currently, the Alouettes rank last in the CFL with 69 total points and 26:21 possession minutes per game.
Sri Lanka had resumed on day two on 277-9 and extended its first innings with a record 74-run, last-wicket stand.
Temba Bavuma, who came to the crease with Dananjaya on a hat-trick, remained 14 not out.
Earlier, Sri Lanka added a further 125 runs to their already-mammoth 364-run lead, as acting captain Suranga Lakmal delayed the declaration until after halfway through the second session. At the age of 25 he is certainly one of the young South Africans to take the Proteas batting forward.
However, South Africa's win/loss ratio of 0.93 still compares favourably with next-best Australia (28 wins, 35 defeats), with the West Indies somewhat surprisingly third, ahead of England.