A maiden Test century from Kaushal Silva put Sri Lanka in a position of dominance against Bangladesh on day two in Mirpur.