A splendid over from Dushmanta Chameera helped Sri Lanka regain lost ground as he dismissed Moeen Ali and Stuart Broad - both for ducks - in the same over.
Jonny Bairstow became the first centurion of the English summer as he reached three figures in the first session.
England went into the lunch break on 243 for 8.
Sri Lanka's struggles continued as Ben Stokes too chipped in with a wicket.
Bairstow scored 140 as England finished on 298.
Stuart Broad rocked Sri Lanka early with two quick wickets.
Anderson's fifer and Broad's four-wicket haul helped England bowl out Sri Lanka for 91 and enforce follow-on before bad light brought an early end to the day's proceedings.
James Anderson went past Kapil Dev's tally of 434 Test wickets