The prolific off-spinner, who claimed five wickets in the first innings, finished with 7-97 in the second as South Africa were bowled out for 311 in the first hour of the fourth day's play at the Sara Oval on Monday.
South Africa have five sessions and an hour to take 10 wickets for a series-levelling win after being thrashed by an innings and 153 runs in the first Test at the Sinhalese sport club.
Muralitharan claimed all three remaining wickets after South Africa resumed at their overnight score of 257-7.
He had Nicky Boje caught behind for 15, trapped Dale Steyn leg-before for zero and dismissed Mark Boucher to a catch at short-leg by Tillekeratne Dilshan.
Boucher made 65, adding 29 valuable runs for the last wicket with Makhaya Ntini, who remained unbeaten on five.
Muralitharan's 12-225 here follows his match haul of 10-172 in the previous Test and 11-132 and 10-115 against England in Nottingham and Birmingham earlier in the year.
The 34-year-old's earlier feat of four successive 10-wicket hauls came at home during the 2001-2002 season when he took 11-196 against India, 10-111 against Bangladesh and 11-170 and 10-135 against the West Indies.
Muralitharan now has 657 wickets, second behind Australian record-holder Shane Warne's tally of 685, following his 18th 10-wicket success and 56th five-wickets-in-an innings haul.
Muralitharan ended the short two-match series with 22 wickets.