Bangladesh amassed their highest total and captain Mushfiqur Rahim chalked up their first Test double century on the fourth day of the opening game against Sri Lanka on Monday.
Resuming on 438 for four, Bangladesh went on to make 638 all out by tea, a first-innings lead of 68.
Sri Lanka then reached the close on 116 for one, with Tillakaratne Dilshan unbeaten on 63 on a lifeless pitch where bat has dominated ball from the start.
It was the second half-century of the match for Dilshan, who was accompanied back to the pavilion by Kumar Sangakkara (49 not out).
With one day left, the game seems destined to end in a tame draw.
Mushfiqur, on 198 at lunch, picked up two singles after the resumption and celebrated his double hundred by punching the air and kissing the turf.
The diminutive 24-year-old batsman was immediately out for 200, trapped lbw by Nuwan Kulasekera off the next delivery.
Mushfiqur's gritty 321-ball knock lasted 438 minutes and included 22 fours and a six.
After Mohammad Ashraful (190) had added one run to his overnight score, Nasir Hossain (100) joined in the run feast and became the sixth centurion in the match.
Nasir's maiden Test hundred came off 151 balls and contained nine fours.
He and Mushfiqur added 106 runs for the sixth wicket before Dilshan had Nasir caught by Sangakkara.
The total by Bangladesh, ninth and last in the Test world rankings, eclipsed the 556 they compiled against West Indies in Dhaka in November.
The second and final Test between Sri Lanka and Bangladesh in Colombo starts on Saturday.
Scorecard
Sri Lanka (1st innings): 570-4 decl
Bangladesh (1st innings): (overnight 438-4)
Jahurul Islam c Chandimal b Eranga 20
Anamul Haque b Mendis 13
Mohammad Ashraful c Mathews b Herath 190
Mominul Haque c Mathews b Kulasekara 55
Mahmudullah st Chandimal b Herath 0
Mushfiqur Rahim lbw b Kulasekara 200
Nasir Hossain c Sangakkara b Dilshan 100
Sohag Gazi c Vithanage b Mendis 21
Abul Hasan not out 16
Elias Sunny c Chandimal b Dilshan 0
Shahadat Hossain b Eranga 13
Extras: (b-2, lb-1, nb-7) 10
Total: 638
Fall of wickets: 1-23, 2-65, 3-170, 4-177, 5-444, 6-550, 7-581, 8-618, 9-618.
Bowling: Kulasekara 27-3-94-2 (nb-1), Eranga 34-4-122-2 (nb-6), Herath 62-11-161-2, Mendis 36-3-152-2, Mathews 9-2-18-0, Dilshan 26-5-75-2, Thirimanne 2-0-13-0.
Sri Lanka (2nd innings):
D. Karunaratne c Abul b Shahadat 3
T. Dilshan not out 63
K. Sangakkara not out 49
Extras: (nb-1) 1
Total: (for 1 wicket) 116
Fall of wickets: 1-17
Bowling: Shahadat 5-1-18-1 (nb-1), Abul 5-0-15-0, Gazi 9-1-37-0, Sunny 5-0-14-0, Mominul 3-0-13-0, Ashraful 1-0-10-0, Mahmudullah 2-0-9-0.
Photograph: Stu Forster/Getty Images
Sangakkara hits 31st Test ton as Bangladesh toil
Maiden tons give Sri Lanka huge lead over Bangladesh
Bangladesh recall spinner Enamul for Sri Lanka Tests
Check out the squads for IPL 6
Ashraful heroics boost Bangladesh in Galle