(Updates at tea)
* Sri Lanka lose early wicket in second innings
* Visitors set target of 507 runs to win
* South Africa looking for series victory
CAPE TOWN, Jan 4 (Reuters) - South African pace man Vernon Philander made early inroads on Wednesday as he took the first wicket of Sri Lanka's second innings and began the bid to bring an early end to the second test at Newlands.
Sri Lanka were 17-1 at tea on the third day, facing the inevitably of defeat after being set a nominal target of 507 run to keep alive the series.
South Africa declared their second innings midway through Wednesday's second session, giving themselves more than two days to claim the 10 wickets they need for a second successive test win and the series victory.
Dimuth Karunaratne was clean bowled by a ball from Philander that swung back in and toppled the wickets in the sixth over of the innings. He had made just six.
Kaushal Silva (7) and Kusal Mendis (4) were not out at tea but face a long haul as the home side seek to wrap up the result early.
Sri Lanka were put into bat midway through the second session after the South Africans' lead went past 500 runs. They declared on 224 for seven, having resumed at 35-0 overnight.
Seamer Suranga Lakmal took four wickets in a rare highlight for Sri Lanka while Dean Elgar top scored for the home side with 55, to add to his first-innings century, after being 19 not out overnight. He edged veteran spinner Rangana Herath to Angelo Mathews at first slip to be the third wicket to fall on Wednesday.
First to go was Stephen Cook, who was squared up by Lakmal and edged the ball to Karunaratne in the slips, to be dismissed for 30.
Five balls later Lakmal tempted Hashim Amla forward and a tentative push saw him get caught behind without scoring as his wretched run of form continued.
JP Duminy (30) was adjudged lbw when Lakmal rapped him on the pads in the last over before lunch.
After the break, Temba Bavuma was run out without scoring before Lakmal delivered another ball with a hint of away swing to have Faf du Plessis caught behind for 41.
Quinton de Kock, another first-innings centurion, was then out for 29 leaving Keshav Maharaj (20) and Philander (15) not out at the crease when the declaration came.
South Africa scored 392 in their first innings to which Sri Lanka replied with a paltry 110. The hosts, who won the first test in Port Elizabeth last week, did not enforce the follow-on. (Reporting by Mark Gleeson; Editing by Clare Fallon)