COLOMBO - Kumar Sangakkara and skipper Angelo Mathews struck brisk half-centuries to help Sri Lanka set up a thrilling finale to the series-deciding second Test against South Africa on Sunday.
Sangakkara (72) hit his tenth 50-plus score of the year and Mathews chipped in with an unbeaten 63 as the hosts declared their second innings on 229-8 shortly before close of play to set the visitors an imposing target of 369.
At stumps on a rain-interrupted day four, South Africa were 38-1, needing 331 more runs off a minimum 98 overs to pull off a series-clinching win.
Quinton de Kock (21) and Dean Elgar (13) were the not out batsmen at the crease.
The hosts, who posted 421 in their first essay, had bowled out South Africa for 282 in their first innings to gain a 139-run lead.
South Africa lead the two-Test series 1-0 after winning the opener in Galle by 153 runs. Even a draw in this game will see the Proteas reclaim the world number one ranking from Australia.
South Africa's chase did not start the way they had hoped for as they lost their first wicket with just six runs on the board.
Opener Alviro Petersen (zero) failed for the second time in the game when he was caught off left-arm spinner Rangana Herath, who opened the bowling.
The Sri Lankan batsmen had started off confidently after rain interrupted play for an hour following the lunch break.
Sangakkara unleashed his trademark silken pulls and drives to race to the 50-run mark with a boundary off leg-spinner Imran Tahir (2-76).
Just when he was looking good for a bigger score, he edged to wicketkeeper De Kock off Morne Morkel (4-45), bringing an end to his enterprising knock that included eight hits to the fence.
Kithruwan Vithanage (seven) was superbly caught by Faf du Plessis who ran backwards without taking his eyes off the ball and then dived forward to pluck it inches off the ground.
Test debutant Niroshan Dickwella top-edged to AB de Villiers off Dale Steyn (2-59), failing to repeat his first innings performance which saw him score 72.
Tahir bowled Dilruwan Perera and Morkel sent back Rangana Herath, prompting skipper Mathews to declare the innings.
Earlier, Sri Lanka added a healthy 97 runs in the first session while losing their openers and the prolific Mahela Jayawardene.
Opener Upul Tharanga (30) looked in good nick but he edged behind to the keeper while trying to drive Steyn in the sixth over of the morning.
Kaushal Silva welcomed Tahir (1-67) with a neat sweep to the fence in the bowler's first over, setting the tone for the rest of the session that saw the hosts score at a quick pace.
Silva had made 26 when he scooped a drive, offering an easy catch to Vernon Philander at point off Morkel.
Jayawardene, who cracked a solid 165 in the first innings, was out for a duck in a bizarre fashion off Tahir.
The stylish right-hander played the reverse sweep but the ball popped up and Dean Elgar rushed across from short leg to pouch the ball before crashing into De Kock.
Jayawardene was given out but he sought a review believing that the ball had not touched his glove. However, the decision of the on-field umpire was upheld and the batsman walked away shaking his head in disappointment.