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.
The skipper sustained an injury to his leg while bowling in the nets in Dhaka on Friday, Tamim to lead Bangladesh.
Shaheen takes six wickets as Pakistan hammer Bangladesh by 94 runs in their last World Cup match.
India finally confirmed their place in the World Cup semi-finals with a comfortable if not flawless win which eliminated spirited Bangladesh.