England spinners led by Moeen Ali helped dismiss Sri Lanka for 203 and build on their advantage after wicketkeeper-batsman Ben Foakes' debut ton in the first Test on Wednesday.
The islanders conceded a 139-run lead in response to England's 342 after being bowled out in the final session of play on day two on a turning Galle pitch notorious for its low scores.
Ali claimed four wickets and was ably supported by fellow spinners Jack Leach and Adil Rashid who took two each.
England were 38 for no loss at stumps in their second innings, stretching their lead to 177 runs. Debutant Rory Burns, on 11, and Keaton Jennings, on 26, were batting at close of play.
But it was Foakes who stood out with his patient yet effective batting in England's first essay to give the team a challenging total after electing to bat first.
The 25-year-old Foakes, who replaced injured Jonny Bairstow converted his overnight 87 to 107 in the morning session to become only the fifth wicketkeeper-batsman to score a hundred in his first Test.
For Sri Lanka, Angleo Mathews top-scored with 52 and put on a crucial 75-run stand for the fifth wicket with skipper Dinesh Chandimal, who made 33, to frustrate the opposition bowlers.
Rashid broke the key stand after getting Chandimal stumped on a classic leg-spinner but Mathews went on to register his 30th Test 50.
He did not trouble the scorers after the tea break as Ali got the dangerman trudging back to the pavilion in the first over of the final session.
Dilruwan Perera, who picked up five wickets in the England innings, crossed 1000 Test runs on his way to 21. He became the fastest Sri Lankan to claim a double of 100 wickets and 1,000 runs.
England were troubled by a nasty hit to Burns while fielding at forward short leg, prompting the umpires to call for early tea.
Burns, who injured his shoulder blades at the base of his neck after trying to duck under a sweep shot from Dickwella, came back to field, much to the delight of the English fans.
The biggest cheer though was reserved for the retiring Rangana Herath who walked in amid a rousing reception as the English team lined up to receive the spin legend in the middle.
He remained unbeaten on 14 after Rashid got the final wicket Suranga Lakmal for 15.
Herath, 40, bids farewell to his international career at the start of the three-match series at his favourite hunting ground that accounts for 100 -- he got to the mark in England's innings after getting skipper Joe Root out for 35 -- of his 431 Test victims