Cook was 129 not out and Trott 125 not as England closed on 287 for two in reply to Sri Lanka's first innings 400, a deficit of 113, at stumps on the third day in this opening match of a three-Test series.
Cook's hundred was also his second in as many Test innings following the 189 he made in an innings win against Australia in Sydney in January.
That victory completed a 3-1 Ashes series triumph during which the Essex opener scored a mammoth 766 runs at 127.66.
Meanwhile, Cook and Trott's so far unbroken stand of 240 was their fourth century partnership in eight Tests, following 116 against Pakistan at The Oval, 329 in the Ashes opener against Australia at Brisbane and 173 in Adelaide.
"It's nice to score a few again and continue from Australia," Cook told reporters.
"It's pleasing personally but it's also put us in a position where we can win this game.
"This was an opportunity for Trotty and I to make big ones (hundreds).
"The only way we can win this game is to bat once a