De Silva made an unbeaten 104 while Mendis hit 83 not out, guiding Sri Lanka to 187-1 at stumps on the second day.
Earlier, Rangana Herath and Suranga Lakmal took three wickets each to help the visitors dismiss Bangladesh for 513 in their first innings.
The pair came together after spinner Mehedi Hasan got rid of Dimuth Karunaratne for a duck shortly after Bangladesh's innings ended with skipper Mahmudullah Riyad unbeaten on 83.
This is de Silva's second successive Test century after scoring an unbeaten 119 in Sri Lanka's last match against India in New Delhi in December.
More From This Section
Bangladesh, who are now leading Sri Lanka by 326 runs, wasted two reviews against Mendis and also dropped two chances offered by the right-hander.
Mehedi dropped Mendis on four off paceman Mustafizur Rahman at second slip, before Imrul Kayes grassed another chance -- this time off Mehedi's bowling -- with the batsman on 57.
Mahmudullah added 58 runs with debutant Sunzamul Islam for the eighth wicket, after three quick wickets rattled the home side early in the morning.
Spinner Herath brought Mominul Haque's majestic knock to an end in the third over of the day when the left-handed batsman flicked a catch to Mendis at forward short-leg. He made 176.
Mominul who hit 16 fours and a six, faced 214 balls and added just one run to his overnight score.
Mehedi took Bangladesh past 400 with a lovely straight drive off paceman Lakmal, before smashing Herath for a six.
But he was soon run out for 20 by Lahiru Kumara at third man.
Sunzamul made 24 runs before he was stumped off left-arm wrist spinner Sandakan.