The pair first powered Sri Lanka to an imposing total before Shanaka picked up 3 for 27 derailed Bangladesh chase.
The hosts pick up a seven-wicket win to take a 2-0 lead - their first home series win in 44 months.
A century from Kusal Perera ton helped Sri Lanka post 314 before Bangladesh were bowled out for 223.
Lasith Malinga to retire from ODIs after first match against Bangladesh.
Dickwella, Dananjaya back; no Chandimal for Bangladesh ODIs
The skipper sustained an injury to his leg while bowling in the nets in Dhaka on Friday, Tamim to lead Bangladesh.