Jayawardene had made 203 and Kithuruwan Vithanage had reached 103 not out when captain Angelo Mathews decided a lead just short of 500 was enough and declared the first innings on 730 for six.
That massive total came in reply to Bangladesh's 232 as Sri Lanka looked to take the lead in the two-Test series.
Jayawardene's double century came off 271 balls and effectively took the game away from Bangladesh.
There were 16 fours and four sixes in a dominant innings which was ably supported by the hundred scored by Vithanage as Sri Lanka made their hosts toil.
Jayawardene had started the day just short of his half century but with Sri Lanka already leading the scene was set for the tourists to set up a commanding lead of 498 runs on first innings.
Mathews also weighed in with 86 but it was the unbeaten partnership of 176 between Jayawardene and Vithanage which really put the visitors in charge of the match.
On a day when Bangladesh struggled in the field and used eight bowlers Shakib Al Hasan was the pick of a pretty poor bunch with his three wickets coming at a cost of 159 runs.
Bangladesh's bid to avoid an innings defeat got off to a bad start as opener Tamim Iqbal fell with the total on just 15.
Tamim had contributed 11 of those runs when he was caught by Dilruwan Perera off the bowling of Rangana Herath.
Shamsur Rahman and Marshall Ayub guided Bangladesh to the close of play without any further loss but the hosts were still up against it in their bid to avoid an innings defeat.
They had reached 35 for one to trail Sri Lanka by 463 runs with Shamsur on nine and Ayub not out 11.
But any hopes they had of saving the opening Test were slim with two days left to play.