Sri Lanka are on course to beat South Africa with one day to play in the second Test in Colombo - but bad weather could thwart their bid for victory.
After dismissing the Proteas for a below-par 282 in response to their first-innings 421, Sri Lanka declared on 229 for eight - setting Hashim Amla's men 369 runs to win the match and take the two-Test series 2-0.
South Africa, in their 17 overs before rain and bad light brought play to an end, reached 38 for one in reply - 331 runs shy of what would be the joint-sixth-highest Test run-chase.
Showers are expected tomorrow, however, which could thwart Sri Lanka's efforts to draw the series after losing the first Test by 153 runs in Galle last week.
Sri Lanka resumed this morning on 11 without loss intent on quickly establishing a commanding lead.
Upul Tharanga reached 30 in 10 overs but his innings came to an end when Dale Steyn got a full ball to move away and Tharanga could only edge behind to give stand-in wicketkeeper Quinton de Kock his fifth catch of the match.
Kaushal Silva and Kumar Sangakkara added 44 runs in 10 overs for the second wicket before Silva was caught at point off Morne Morkel to leave Sri Lanka 82 for two, and they lost their third wicket for only one run added when Mahela Jayawardene, attempting a reverse-sweep, gloved an Imran Tahir delivery to Dean Elgar at bat-pad.
After a short rain delay, Sangakkara pulled a Tahir delivery to the ropes to reach his 49th Test half-century. He added a further 22 runs to his score before edging Morkel behind to leave Sri Lanka 164 for four.
Sri Lanka skipper Angelo Mathews took the attack to South Africa's bowlers and after Morkel had accounted for Kithuruwan Vithanage and Steyn removed Niroshan Dickwella before tea, he claimed his 15th Test fifty as Sri Lanka passed 200.
Tahir claimed Dilruwan Perera's wicket and Morkel snaffled Rangana Herath before Mathews, unbeaten on 63, declared to set the tourists an imposing 369.
South Africa's second innings got off to a dismal start when, having not scored for 25 balls, Alviro Petersen fended a catch to silly point to give Herath, who took four wickets in South Africa's first innings, his first of their second.
Bad light stopped play after 17 overs with South Africa 38 for one and, after the rain returned, umpires Richard Kettleborough and Nigel Llong called a halt to proceedings for the day.