At stumps on the second day of the second Test, Sri Lanka, in their second innings, were 86 for four - still 68 runs behind England's first innings 295.
Michael Vandort was 30 not out and Tillakaratne Dilshan 21 not out.
Pietersen's 142 was the centrepiece of England's total, which put them 154 ahead after they'd bowled out Sri Lanka for 141.
The tourists' plight would have been worse had not Muttiah Muralitharan taken six for 86, the 52nd time had claimed five or more wickets in a Test innings.
By dismissing Pietersen, the off-spinner sparked an England collapse that saw their last five wickets fall for five runs in 29 balls.
However, an admiring Murali compared Pietersen to the cream of world batting: "I think Pietersen is on top of the world at the moment, the way he is batting. He has got everything right in armoury. He has more power than any other player.
"His natural talent is to be aggressive. The way he plays, he takes his chances, so most of the time he succeeds.
"His record is unbelievable because he has scored something like 1,300 runs in 13 Test matches," Murali also told reporters.
Meanwhile, Pietersen insisted batting against Muralitharan was not as easy for him as it appeared. "I've got a pretty good reach and I get forward which can negate a lot of the spin.
"But he's the world's best off-spinner. I'm not picking him as much as everyone thinks I am."
He added: "I'm just happy I'm converting my starts into hundreds. I didn't do that in India and it's good to know I can still get to three figures."
Sri Lanka's second innings began badly when Upul Tharanga completed a pair, caught behind off Matthew Hoggard's fourth delivery
Then Kumar Sangakkara, on 18, chipped left-arm spinner Monty Panesar's fourth ball to Paul Collingwood at mid-wicket.
Sri Lanka slumped further when captain Mahela Jayawardene, whose century helped draw the series opener at Lord's where Sri Lanka batted 14 hours in their second innings to save the game, was lbw to Hoggard for five.
Panesar then produced a fine delivery to lure Thilan Samaraweera (eight) out of his crease as the batsman pushed forward and Geraint Jones completed a stumping.
Sri Lanka were 56 for four and there was now a chance of a two-day finish in what, under sunny skies, were the best batting conditions of the match.
Pietersen, who equalled his Test-best 158 at Lord's, became the first England batsman since Graham Gooch 16 years ago to score hundreds in three succesive home Test innings after also making 158 against Australia at The Oval in September.
Gooch scored 333 and 123 in the first Test against India at Lord's in 1990 and 116 in the first innings of the second Test at Old Trafford.
Pietersen, who began the day on 30 not out, was rarely unsettled and a boundary through mid-wicket off Nuwan Kulasekara saw the 25-year-old South Africa-born batsman to his fourth Test hundred.
Pietersen then on-drove Kulasekara for six, the second time he'd cleared the ropes after lofting Muralitharan on Thursday.
But that was nothing compared to his flamboyantly reverse-swept six off Muralitharan on Friday.
"It was a very naughty shot," Pietersen admitted. "It was pre-meditated. My only option was to reverse-sweep because all the other scoring areas were covered. I'd got 136, I might as well have a go. But I didn't think it would go go for six."
However, two balls later Murali had Pietersen plumb leg before, sweeping.
In all, Pietersen faced 157 balls with three sixes and 20 fours. At that stage England were 290 for six, only for the rest of the innings to end tamely.