A double strike by off-spinner Graeme Swann in the penultimate over of the fourth day put England within reach of victory in the second and final Test against Sri Lanka on Friday.
England need to win the match to square the series and retain their world number one ranking.
Having safely negotiated the second new ball, Sri Lanka appeared to be relatively safe at 215 for four before Swann sent back Thilan Samaraweera (47) and nightwatchman Suraj Randiv for a duck in the space of three balls to swing the Test England's way.
At the close, Sri Lanka who trailed England by 185 runs on the first innings, were 218 for six, an overall lead of 33 runs.
Swann, who also dismissed Tillakaratne Dilshan (35) and Kumar Sangakkara (21), ended the day with four wickets for 82.
Dilshan, who was fined 10 percent of his match fee for excessive appealing, was unhappy after he was given out, caught at slip by James Anderson.
The batsman asked for a review but with no Hot Spot technology available, there was no conclusive evidence to overrule the on-field umpire's decision.
Swann then removed Sangakkara, who had struggled for nearly two hours before edging a catch behind the wicket to Matt Prior.
Sri Lanka lost both openers in the morning session when the English pace bowlers removed Dhammika Prasad (34) and Lahiru Thirimanne (11) but not before the visitors paid for some sloppy fielding.
Anderson got rid of the shaky Thirimanne, who edged a catch to Andrew Strauss at slip with the total on 23.
Prasad, sent in as a nightwatchman, justified his promotion and hung around for 87 minutes before he pulled Steven Finn straight to Tim Bresnan at deep square leg.
It was some relief for Finn, who had dropped Prasad at mid-off when the batsman was on 21.
The missed opportunity was a second heartbreak for Swann, who earlier saw Matt Prior gift Thirimanne a reprieve by wasting a simple stumping chance.
Bresnan also dropped Jayawardene on 20 when he lofted Samit Patel but the fielder, at deep mid-wicket, could get only a hand to the ball as it sailed over his head for four.
Scorecard
Sri Lanka first innings 275
England first innings 460
Sri Lanka second innings (overnight 4-0)
D. Prasad c Bresnan b Finn 34
L. Thirimanne c Strauss b Anderson 11
T. Dilshan c Anderson b Swann 35
K. Sangakkara c Prior b Swann 21
M. Jayawardene not out 55
T. Samaraweera b Swann 47
S. Randiv b Swann 0
A. Mathews not out 3
Extras (b-4, lb-6, w-2) 12
Total (six wickets, 91 overs) 218
Fall of wickets: 1-23, 2-64, 3-104, 4-125, 5-215, 6-215
Bowling: Anderson 16-6-27-1, Finn 15-1-30-1 (1w), Swann 26-1-82-4, Bresnan 11-5-14-0 (1w), Patel 19-6-37-0, Pietersen 4-0-18-0.
Jayawardene frustrates England with another ton
Dilshan fined for breaching ICC Code of Conduct
England in command after Pietersen hundred
Openers Strauss, Cook set up strong England reply
Pietersen warned over switch-hit attempt