Moeen Ali made a Test-best 155 not, including 70 of the 90 England made after lunch before Cook closed the innings.
Nuwan Pradeep took four for 107 in 33 overs, while left-arm spinner Rangana Herath's lone wicket of the innings saw him to 300 wickets in Tests.
England lead the three-match series 1-0 following their innings and 88-run victory in the first Test at Headingley last week.