Bangladesh took a first innings lead of 78 runs before they were all out for 326 runs during the extended second session of the third day’s play in Chittagong.
South Africa, who made 248 in the first innings, were 61 without loss in their second knock when bad light forced an early stumps with 24.5 overs left to be bowled.
Openers Stiaan van Zyl was unbeaten on 33 and Dean Elgar on 28 not out. The tourists still trail by 17 runs.
Fast bowler Dale Steyn finished with 3-78 as he moved closer to becoming only the second South African bowler after former captain Shaun Pollock to take 400 Test wickets.
Off-spinner Simon Harmer also claimed three wickets, including the key outs of Das and Shakib, to give South Africa a lifeline in what is shaping into a close contest.
Das made 50 off 102 balls with the help of seven boundaries and tail-ender Mohammad Shahid belted 25 off 19 balls to provide Bangladesh the edge.
Steyn had Mushfiqur Rahim leg-before for 28 in South Africa’s only success of the morning session, but Shakib (47) and Das stood firm to defy the visiting bowlers.
Rahim, who was initially given not out before South Africa successfully reviewed the decision, added 12 runs to his overnight score.
Das drove Steyn to take Bangladesh past South Africa’s first innings total and took a single off the next ball to help his team equal their highest score of 252 runs against the Proteas.
Bangladesh, who have lost their previous eight Tests against South Africa, most of them by an innings margin, had made an impressive start to the match by bowling out the Proteas cheaply on the opening day.
Mahmudullah scored 67 and Tamim Iqbal added 57 in the rain-shortened second day to lay a strong foundation for the home side.
The second match of the two-Test series will be played in Dhaka from July 30-August 3.
Follow us on Twitter @NatSportUAE