Cook's knock of 129 not out came from 263 balls with 10 fours, while Trott's innings of 125 not out came from 219 balls with 11 fours.
Ajantha Mendis (1-43) was the only Sri Lanka bowler to take a wicket at Sophia Gardens, removing nightwatchman James Anderson for 1.
Anderson can bat but will not bowl again in this test, after incurring a side strain on Friday.
Heavy rain delayed the start of play with the morning session wiped out and the teams taking an early lunch.
England finally resumed the day on 47-1, in reply to Sri Lanka's first innings total of 400.
Before England had added to its overnight score, Anderson fell to the 17th ball of the day, caught by Mahela Jayawardene in the slips.
But batting conditions improved and, after a tentative start, Cook and Trott went on the attack.
Cook reached 50 from 112 balls, while Trott was helped when he made his ground before a direct hit from Suranga Lakmal hit his stumps and rebounded to the boundary for four overthrows.
The century partnership was brought up when Cook glanced the final ball of the afternoon session from Mendis to deep midwicket.
Trott reached 50, from 102 balls, in the first over of an extended evening session during which the bowlers struggled to pose any kind of threat and the fielders failed to take the few chances offered.
When Trott called for a rash single he was well short of his ground, but Suranga Lakmal missed with a shy at the stumps.
It was more than an hour later when Tharanga Paranavitana dropped a difficult chance from Cook at short leg and the batsman survived to reach his 17th test century, from 224 balls when he cut Lakmal through point.
Trott brought up his sixth Test hundred driving Lakmal through the covers with a shot that also brought up the 200 partnership.
The second new ball made no impact and Cook and Trott's partnership was 240 not out by the close of play, leaving England 113 runs behind.
However, with the home side reduced to three orthodox bowlers and further rain forecast for the final two days, a draw is the most likely result.
Cook, Trott centuries inspire England
Publication Date:
Sun, 2011-05-29 00:11
Taxonomy upgrade extras:
© 2024 SAUDI RESEARCH & PUBLISHING COMPANY, All Rights Reserved And subject to Terms of Use Agreement.