Signs of stress were evident early in the afternoon when England team director Andy Flower went into the match referee's room to remonstrate after Samaraweera was given not out - both by on-field umpire Asad Rauf and on review - following an appeal for a catch at short leg off Finn.
Geoffrey BoycottEx-England batsman & Test Match Special summariser
"It was a slow day, but England just kept on sneaking a wicket and that gets them fractionally ahead. I have seen the odd ball turn and bounce and a couple from the seamers have kept a little low, but I didn't see anything in the pitch that you couldn't play with decent technique, patience and concentration."
Jayawardene, who made a superb 180 in the first Test, again came to the crease with Anderson on a hat-trick.
He resisted doggedly for most of the day, but his departure 10 overs before the close improved England's mood.
With Stuart Broad injured and slow left-armer Monty Panesar dropped in favour of an extra seamer, Finn and Tim Bresnan returned to the England side.
England's spearhead, though, was the impressive Anderson, who had Tillakaratne Dilshan well taken low down by wicketkeeper Matt Prior.
Kumar Sangakkara's miserable series continued when he edged his first ball to a juggling Strauss at first slip, and Anderson trapped Lahiru Thirimanne lbw to further strengthen England's position.
It was left to Jayawardene to mastermind another Sri Lanka rebuilding operation, accompanied by the gritty Samaraweera for almost 42 overs until the latter was pinned in front by Bresnan.
Jayawardene, who edged Anderson between wicketkeeper and slip on 79, went to his 31st Test hundred - off 195 balls - shortly before falling lbw to Swann, bowling round the wicket.
England had further reason to celebrate when Finn located Prasanna Jayawardene's edge five overs later, but Angelo Mathews will resume on 41 not out and the tourists' optimism will be tempered by the knowledge they have struggled so badly with the bat this winter.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.