India in charge of the 3rd test; Sri Lanka 19-1 following on

Indian players gesture towards team's dressing room as they leave the field at the end of the second day's play of their third cricket test match against Sri Lanka in Pallekele, Sri Lanka, Sunday, Aug. 13, 2017. (AP Photo/Eranga Jayawardena)

Sri Lanka's Upul Tharanga looks back as he is bowled out by India's Umesh Yadav during the second day's play of their third cricket test match in Pallekele, Sri Lanka, Sunday, Aug. 13, 2017. (AP Photo/Eranga Jayawardena)

India's Kuldeep Yadav, center, shares a laugh with teammates Mohammed Shami, right, and Lokesh Rahul as they leave the ground at the end of Sri Lanka's first innings on the second day's play of their third cricket test match in Pallekele, Sri Lanka, Sunday, Aug. 13, 2017. (AP Photo/Eranga Jayawardena)

PALLEKELE, Sri Lanka — India is in a winning position in the third and final cricket test as Sri Lanka, following on, reached 19 for one at stumps on the second day Sunday.

The hosts still need 333 runs with nine wickets in hand to avoid an innings defeat.

Earlier Indian spinner Kuldeep Yadav took four wickets to help India end Sri Lanka's first innings on 135.

India was dismissed for 487 in its first innings backed by centuries from Shikhar Dhawan and Hardik Pandya.

India is eyeing a series whitewash having won both the previous tests convincingly.

When Sri Lanka came out to bat in the first innings seam bowler Mohammed Shami had Tharanga (4) and Karunaratne (5) caught by wicketkeeper Wriddhiman Saha while Kusal Mendis was run out for 18.

Pandya, who smashed a maiden test century earlier, returned with the ball to trap Angelo Mathews lbw without scoring leaving Sri Lanka on 38 for four.

Captain Dinesh Chandimal and Niroshan Dickwella put together the best partnership of the innings, sharing 63 runs for the fifth wicket.

The slide started again when Dickwella stepped out to hit Kuldeep Yadav and was stumped by Saha.

Chandimal was out for 48 caught at leg slip by Lokesh Rahul off Ravichandran Ashwin.

Kuldeep Yadav finished with four for 40.

Earlier Pandya, playing in just his third test, smacked seven sixes and eight fours in making 108 which came off 96 balls. Dhawan was out for 119 on the opening day.

Pandya told reporters that his team's standing in the match suited his aggressive style of batting.

"Could there have been a bigger opportunity than that? Nine wickets were already down and I knew, if I stay in the crease and connect the ball well, it would go for six. Even if I were to mishit, I had to. I had no choice," he said.

"It was an ideal opportunity and obviously there was a team's goal and which was to them a 400-run target and we scored close to 490. I was taking a calculative risk."

Sri Lanka's batting coach Hashan Tillakaratne said his team was low on confidence.

"It's a disappointing day. We batted so poorly today. I am sure the boys have realized where we went wrong, I am sure they will come up with a better performance tomorrow," he said.

"There are so many things you can say when the team is not doing too well, we have to back the guys and give them confidence."

India, already 2-0 ahead in the series, made 487 in the first innings, which ended three balls after lunch on day two.

The tourists lost overnight batsman Saha for 16 with the total on 339 when he was caught at gully by Dilruwan Perera off seamer Vishwa Fernando.

Kuldeep Yadav and Pandya added 62 runs for the seventh wicket before left-arm wrist spinner Lakshan Sandakan broke the partnership when he had Yadav caught behind by Dickwella.

India fell to 421-9 when Shami was caught and bowled by Sandakan, prompting Pandya to go on the attack and shield last man Umesh Yadav from the strike.

Pandya belted 26 runs from one over bowled by left-arm spinner Pushpakumara and raced to his hundred off just 86 deliveries.

Sandakan was the pick of the Sri Lanka bowlers, capturing five for 132, his first test five-wicket haul.