England lost their first five wickets in only 15 overs, but still had a teatime lead of 239 on day four of the first Investec Test at Lord's.
After bowling Sri Lanka out for 453, to establish an advantage of 122 despite a century from visiting captain Angelo Mathews (102), the task apparently facing England was to balance risk and reward with the bat.
On a pitch which has offered the bowlers little throughout, it seemed they would need the entire final day to bowl Sri Lanka out a second time.
Shaminda Eranga (three for 28) and Rangana Herath had other ideas, though, the seamer taking three for three at one stage in a fine spell from the Nursery end and the slow left-armer then bagging two wickets in three balls as England faltered from 46 without loss to 117 for five.
First-change Eranga made short work of both openers, Cook edging behind as he attempted a flat-footed drive and debutant Sam Robson bowled off an inside edge through the gate by a ball which held its line up the slope.
Ian Bell soon went in near action replay to Eranga, although trying to play a more expansive shot.
First-innings double-centurion Joe Root made only 15, Herath turning one past his defence to hit the back pad.
Moeen Ali responded by going up the pitch first ball to hit Herath over mid-on for four, only to be bowled by the next delivery - a beauty that spun up the slope.
Matt Prior then endured an uncanny repeat from the first innings, again reprieved on nought by 'umpire's call' after a review when Herath thought he had hit him in line lbw - this time from the third rather than second ball he faced.
On Thursday, Prior went on to make 86. Something similar was badly needed by England.
Mathews' 171-ball hundred, to add to Kumar Sangakkara's memorable 147, had helped to keep England out in the field for another 75 minutes on a cloudy morning.
Mathews received enough support from the tail against England's pace attack to move from an overnight 79 to three figures.
Herath faced 14 balls from Stuart Broad, almost all short, before he found himself having to deal with James Anderson (three for 93) for the first time.
Anderson needed only one shot at the little left-hander too, full and fast enough to knock out middle stump.
Mathews went to his century, in his first Test innings in this country, smashing a full-toss over extra cover for his 12th four from the final ball of an Anderson over - after England had brought up the field to keep number 10 Eranga on strike at the other end.
Mathews lasted only one more delivery, Liam Plunkett immediately seeing him off when he missed a full-length ball and was lbw - before number 11 Nuwan Pradeep was felled by a bouncer from Chris Jordan (three for 102) and smacked the stumps with his bat as he landed to be last out hit-wicket.