England 98 for 2 (Root 67*, Bairstow 24*) trail Sri Lanka 381 (Mathews 110, Dickwella 92, Dilruwan 67, Chandimal 52, Anderson 6-40) by 283 runs
It was a credit to the Sri Lanka batsmen - in particular their proficiency against spin - that James Anderson's six-wicket haul was as much an act of damage limitation as destruction on day two in Galle. When left-arm spinner Lasith Embuldeniya made early inroads, England looked to be in danger.
It took an unbroken partnership worth 93 from Jonny Bairstow, homeward-bound to rest after this match instead of heading to India, and Joe Root to put them back on course, with Root particularly strong on the sweep to reach 67 not out off just 77 deliveries and push England to 98 for 2 by the close.
Where England's spinners had failed - all 10 Sri Lankan wickets fell to the seamers - Embuldeniya accounted for both openers for the third time in as many innings on this tour.
After scores of 4 and 2 in the first Test, Dom Sibley fell to Embuldeniya yet again, this time without scoring, pinned by one that struck him on the knee roll well back in his crease. Compounding the dismissal was Sibley's wasteful review, which only confirmed that the ball was hitting leg stump.
Zak Crawley, who is also yet to reach double figures this series, was out to a good ball from Embuldeniya, angling in and dipping then finding an edge that went straight to Lahiru Thirimanne at slip to put England at 5 for 2 and needing more damage control, this time with the bat. Root and Bairstow dug in to provide just that and ensure that the contest retained its intrigue.
The home side had earlier fought their way into a strong position through impressive innings from Niroshan Dickwella and Dilruwan Perera.
Dickwella fell painfully short of an elusive Test century when he gifted Anderson his fifth wicket, chipping to Jack Leach at mid-off for 92, his highest score in 41 Test appearances.
Dilruwan made an impressive fifty from No. 8, taking to Leach in particular, dancing down the pitch three times to plunder fours through mid-on and mid-off and a six down the ground. He helped add 89 in partnership with Dickwella and then another 49 for the last two wickets to frustrate England.
It was another improved batting performance from Sri Lanka after their woeful start to the first Test, with multiple contributors and a stubborn tail.
By shortly after lunch, Anderson, the 38-year-old seamer playing his 157th Test, had doubled his tally from the previous day, adding three more wickets to help end Sri Lanka's innings on 381 and finish with figures of 6 for 40 off 29 overs.
It was Anderson's second straight five-wicket haul in Tests away from home, following his 5 for 40 in Cape Town a year ago, and the 30th of his career - only Richard Hadlee has more among pace bowlers with 36.
He removed centurion Angelo Mathews with his sixth ball on day two and drew Suranga Lakmal into a poke outside off-stump as Crawley took a sharp catch at gully either side of Dickwella's dismissal.
Mathews added just three runs to his overnight score before a subdued England appeal for what looked to be lbw, with the ball appearing to pass the inside edge and deflecting via the knee roll to Jos Buttler behind the stumps. Mathews was originally given not out but Root called for a review and UltraEdge revealed a spike as the ball passed the bat.
That prompted Dickwella to shift gears into drive, quite literally at times, as he assumed the lead upon debutant Ramesh Mendis' arrival at the crease. Dickwella unfurled a series of well-timed boundaries, carving Sam Curran through backward point and punching Mark Wood through long-on.
A fantastic take behind the stumps had Mendis out for a duck, a faint edge off Mark Wood going down the leg side and finding Buttler's glove at full stretch to his left.
Sri Lanka had lost two wickets for 11 runs in the space of 19 balls but Dickwella remained in excellent touch, piercing the covers with two beautiful drives, first off Wood then Anderson. He used Wood's pace to guide the ball effortlessly to the rope at fine leg before bringing up his fifty with a single off Dom Bess, whom he then swept twice to the boundary.
Leach joined Bess in the attack as England opted for dual spinners after the first hour, to Dilruwan's delight. Bess was also on the receiving end of some harsh Dilruwan treatment after lunch, spilling a return catch struck so hard it caused considerable pain to Bess's non-bowling hand.
Wood's hard graft was further rewarded with the wicket of Embuldeniya and Curran finally accounted for last man out Dilruwan, who holed out to Leach at deep backward square leg.