Mahela Jayawardene’s decision to field backfired as the tourists piled on the runs in their bid to square the series, reaching the close at Sinhalese Sports Club on 334 for one.
Mohammed Hafeez (172 not out) and Azhar Ali (92no) shared in an unbroken second wicket partnership of 256 runs, after Taufeeq Amir had contributed 65 to an opening stand of 78.
It represented a good start for Pakistan in their quest to recover from a 209-run defeat in the opening Test.
Opener Taufeeq, who managed just 19 runs from two innings at Galle, profited early on as Sri Lanka’s bowling attack got little help from the track.
The left-hander smashed 12 boundaries in an impressive spell at the crease, bringing up his half-century from just 62 balls.
He eventually came unstuck in the 22nd over, edging Angelo Mathews’ delivery through to wicketkeeper Prasanna Jayawardene to end a 74-ball stay.
Taufeeq combined for an opening stand of 78 with Hafeez, who was in watchful form at the start of this contest.
Azhar was unbeaten on eight at lunch as Pakistan reached the interval on 94 for one – and he provided good support for the remainder of the day.
He reached tea unbeaten on 45, including four boundaries, while Hafeez pressed on with his effort.
The 31-year-old all-rounder had only two nervy moments before reaching his fifth Test century –from 159 balls.
Firstly he survived a difficult chance which Nuwan Kulasekara failed to accept in the deep, then he was fortunate when a Mathews delivery which he gloved to Prasanna Jayawardene was called a no-ball.
At tea, Hafeez was unbeaten on 105 – an effort which included 13 boundaries – as Pakistan totalled 217 for one from 57 overs.
The misery continued for Sri Lanka in the final session, as Hafeez and Ali turned the screw against the hosts.
Ali brought up his 14th Test half-century in the 62nd over, and a little more than eight overs later the pair’s stand hit the 200-run mark.
Wicketkeeper Jayawardene made a loud shout for Hafeez to be caught behind in the 88th over but Australian umpire Simon Taufel rejected the appeal.
Pakistan saw off the remaining 16 balls of the day without further trouble to complete a satisfying day’s cricket for them.