Having conceded a 498-run first innings lead, Bangladesh lost opener Tamim Iqbal (11) to Sri Lankan left-arm spinner Rangana Herath and were 35 for one at stumps on the third day, still needing 463 runs to avoid an innings defeat.
Former captain Jayawardene (203 not out) hit off-spinner Nasir Hossain for two sixes in the same over to reach the double century before running off the ground as Sri Lanka immediately declared their innings.
On a day of batting milestones, Jayawardene (11,236 runs) overtook former Australia captain Allan Border (11,174) and West Indies left-hander Shivnarine Chanderpaul (11,219) to climb up to sixth on the list of highest Test run-getters.
Vithanage (103 not out), playing his third Test, reached the 100-mark in 99 deliveries as the Bangladesh bowlers failed to make any impact on a docile batting pitch.
The duo added 176 runs for the unbroken seventh wicket.
The tourists resumed on 375 for five and captain Angelo Mathews (86) was the lone Sri Lankan wicket to fall on Wednesday, dismissed by off-spinner Sohag Gazi.
Mathews added 179 runs for the sixth wicket with Jayawardene, who remained not out after a 272-ball knock, studded with 16 fours and four sixes.
Scorecard
Bangladesh (1st innings): 232
Sri Lanka (1st innings): (overnight 375-5)
D. Karunaratne c Robiul b Shakib 53
K. Silva lbw Shakib 139
K. Sangakkara c Nasir b Al-Amin 75
M. Jayawardene not out 203
D. Chandimal b Shakib 40
S. Lakmal c Nasir b Gazi 0
A. Mathews c Ayub b Gazi 86
K. Vithanage not out 103
Extras: (b-12, w-12, nb-7) 31
Total: (for six wickets decl; 187.5 overs) 730
Did not bat: D. Perera, S. Eranga, R. Herath
Fall of wickets: 1-118, 2-273, 3-302, 4-374, 5-375, 6-554
Bowling: Robiul 29-2-109-0 (3nb, 2w), Al-Amin 32-3-118-1 (1nb, 1w), Rubel 20-0-84-0 (3nb, 1w), Gazi 39-5-130-2, Shakib 43-6-159-3, Mominul 6-0-20-0, Nasir 10.5-0-60-0, Ayub 8-0-38-0
Bangladesh (2nd innings):
Tamim Iqbal c Perera b Herath 11
Shamsur Rahman not out 9
Marshall Ayub not out 11
Extras: (b-4) 4
Total: (for one wicket; nine overs) 35
To bat: Mominul Haque, Mushfiqur Rahim, Shakib Al Hasan, Nasir Hossain, Sohag Gazi, Robiul Islam, Al-Amin Hossain, Rubel Hossain
Fall of wicket: 1-15
Bowling: Lakmal 3-0-8-0, Eranga 1-0-5-0, Herath 3-2-8-1, Perera 2-0-10-0
Image: Mahela Jayawardene celebrates after scoring a double century, as Kithuruwan Vithanage (right) watches during Day 3 of the first Test between Sri Lanka and Bangladesh.
Photograph: Andrew Biraj/Reuters
Sri Lanka well-placed after seamers dismiss Bangladesh cheaply
Kaushal Silva hits maiden Test ton as Lanka swell lead vs Bangladesh
Pakistan strike early but Sri Lanka extend lead to 220
Sharjah Test: Azhar, Misbah steer Pakistan to dramatic win over Lanka
Jayawardene joins 11,000 Test club