They need only 16 runs to make Pakistan bat again, and will look to bat out at least two of the three sessions on the fifth and final day to salvage an unlikely draw.
Sangakkara found an able ally in Prasanna Jayawardene (25 not out) to fight off the second new ball, with which paceman Umar Gul struck with the first delivery to remove Angelo Mathews (22).
The Sangakkara-Jayawardene stand for the sixth wicket has so far yielded 65 runs.
Playing his 101st Test, Sangakkara took the fight to the Pakistani bowlers, adding an invaluable 153 runs for the second wickets with opener Lahiru Thirimanne who made a career-best 68.Walking into bat after Sri Lanka lost opener Tharanga Paranavitana off the very first ball of their second innings on Thursday, Sangakkara batted with resolve as Sri Lanka, resuming at 47-1, reached 125-1 by lunch.
Pakistan then hit back by dismissing Thirimanne soon after lunch, run out after the opener, taking a second run but failed to beat a throw from the fine-leg by Azhar Ali.
Seven runs later, Mahela Jayawardene (four) played on to off-spinner Saeed Ajmal before paceman Junaid Khan bowled skipper Tillakaratne Dilshan through the gate for nine, leaving Sri Lanka at 191-4.
Despite losing partners, Sangakkara kept his cool, hitting Khan for his 11th boundary to reach three-figure mark, his sixth against Pakistan. He has so far hit 16 boundaries off 295 balls.
Sangakkara said it was one of his best hundreds.
"It would have been nice had I got it in the first innings but it was a tough fight and one of my better hundreds," said Sangakkara. "But there is still work left and if we don't lose a wicket, perhaphs we are able to put some pressure back on Pakistan.
"Anything between 100 or 150 would be a fantastic lead, let's see tomorrow, we want come out fighting again. I feel fantastic and great, once you bat and do the hard work for the team its great."
Pakistan spilled as many as six catches, three off Thirimanne, which helped Sri Lanka fight back.
Khan, who destroyed Sri Lanka with 5-38 in their first innings of 197, was the unlucky bowler on three occasions as Mohammad Hafeez grassed two regulation catches in the slip off Thirimanne when he was on 40.
Much to Khan's disappointment Younis Khan held a sharp edge off Sangakkara but the catch was disallowed by the umpires as the ball had bounced before getting into the hands of the slip fielder.
Pakistan again let off Sangakkara when Younis failed to hold onto a sharp edge when a Saeed Ajmal's delivery surprised the left-handed batsman batting on 56.
Pakistan also let off Prasanna when substitute fielder Wahab Riaz failed to catch a miscued hook off Gul when the batsman was 12.
The two remaining Test matches in the series, shifted to neutral venues over security fears in Pakistan, will be played in Dubai (October 26-30) and Sharjah (November 3-7).