Cape Town - Marco Jansen and Thando Ntini shared nine wickets as South Africa Emerging held the advantage after the penultimate day of their final four-day encounter against Sri Lanka Emerging in Pretoria on Saturday.
The hosts closed day three on 92 for one, a lead of 145 and in a strong position to ensure that they at least draw the game.
Shukri Conrad's side lead the series 1-0 and a shared result in this final game at the LC de Villiers Oval will ensure they win the two-game sequence.
But they had to work hard to get through the Sri Lanka tail after a century by Promod Maduwantha (111 off 236 balls, 9 fours) glued the innings together.
The 22-year-old shared an 83-run seventh-wicket stand with Chamika Karunaratne (53 off 97 balls, 4 fours) that proved key to the Asian side closing the deficit, which eventually proved to be just 53.
Jansen ended as pick of the bowlers with five for 69, while Ntini bagged four for 76.
South Africa then lost Wandile Makwetu (26) to Lasith Embuldeniya in the reply - his ninth wicket of the match - but Janneman Malan (36) and Raynard van Tonder (20) took them to the close in a solid position.