South Africa trailed India by 36 runs after India had posted 280.
The Proteas started the day on 213 for six, and looked to add runs quickly at the start of play.
Philander, resuming on 48 overnight, moved to his half-century off the first ball of the day, crashing one through the covers. Another boundary followed in the same over as South Africa looked to whittle down the deficit.
After racing to 59, Philander was outdone by a probing delivery on offstump from Zaheer Khan which took the edge and was caught by Ravichandran Ashwin at first slip.
The wicket brought to an end an 80-run partnership between Philander and Faf du Plessis (20), after the pair had come to the middle with South Africa in deep trouble at 146 for six on day two.
Du Plessis was induced into an edge by Khan giving wicketkeeper MS Dhoni a straightforward catch.
South Africa added just five more runs before Khan had the last say with a yorker to dismiss Morne Morkel.
Khan took 4/88 in his comeback Test, after close to a year out of the frame, and while Ishant Sharma returned 4/79.