Birthday boy Mendis just missed out on a double century, hitting an impressive 196, while de Silva added 173 as Sri Lanka reached 504-3 at stumps trailing Bangladesh's first innings total by just nine runs.
Roshen Silva was unbeaten on 87 alongside skipper Dinesh Chandimal, 37 not out, when stumps were drawn at the Zahur Ahmed Chowdhury Stadium.
Left-arm spinner Taijul Islam gave Bangladesh a rare occasion for joy on an arduous day when he removed Mendis just before the tea break.
De Silva and Mendis dominated the Bangladesh bowlers for nearly two sessions after Sri Lanka resumed their innings on 187-1.
More From This Section
The hosts had to wait for the second new ball to get their first success as Mustafizur got a leading edge from de Silva and wicketkeeper Liton Das took a high catch.
De Silva faced 229 balls and hit 21 fours along with a six in his fourth Test century and the second in as many Tests.
"I think he is so disappointed," said Sri Lanka batting coach Thilan Samaraweera.
"The bigger picture is that if he had scored those two double-hundreds, it would have been very special for a 23-year old," Samaraweera said of Mendis, whose previous career best was 194 runs.
Mendis survived a run-out when he had a mix-up with Silva in the middle of the pitch after crossing the 150-run mark.
Bangladesh team director Khaled Mahmud admitted that Sri Lanka were now in the driving seat.
"(It) is very important for us to see how quickly we can bowl them out (tomorrow) and then bat well in the second innings," he said.
Bangladesh were also unlucky in the morning when de Silva survived a strong lbw appeal on 119 off Taijul when the ball hit him on his toe before going to the slips.
Having already used both their reviews, the hosts had no choice but to accept the decision of the on-field umpire.
De Silva reached his 1,000 runs in Tests on 154, joining Roy Dias as the quickest Sri Lankan to achieve the feat in his 23rd innings.