Sri Lanka's Kusal Mendis fell agonisingly short of a maiden double century on day two of the first Test against Bangladesh in Galle, but the hosts tightened their grip on the contest.
Mendis' career-best 194 propelled Sri Lanka to 494 all out in their first innings, before Bangladesh closed on 133-2, still 361 runs behind.
Soumya Sarkar (66no) and Tamim Iqbal (57) shared in a 118-run opening stand, but two late wickets rocked the visitors.
Earlier, Sri Lanka - resuming the day on 321-4, with Mendis already 166 not out - kicked on to their imposing first-innings tally thanks to attacking fifties from Niroshan Dickwella (75 off 76 balls) and Dilruwan Perera (51 off 77).
Mendis, meanwhile, smacked Mehedi Hasan (4-113) for his fourth sixth to race to 192 but then fell to the off-spinner when looking to bring up his double century with a fifth, Tamim taking a brilliant catch in the deep.
Realising momentum was taking him across the rope after taking the catch, Tamim lobbed the ball back into play and returned to pouch it, ending Mendis' 285-ball knock.
It was one of four wickets for Mehedi in the innings, with him also dismissing Dickwella, caught at midwicket by Mahmudullah.
Mustafizur Rahman (2-68) then removed Rangana Herath for 14, and Suranga Lakmal was run out for eight to give Bangladesh some respite.
Mehedi trapped Perera lbw shortly after he reached his half century before then taking a stunning catch off Shakib Al Hasan to send last man Lakshan Sandakan (5) packing.
When Bangladesh got underway in their first innings their openers fought back bravely in a century stand, though both Soumya and Tamim benefited from sloppy Sri Lankan fielding.