Mustafizur Rahman, playing his first match in the series, dismissed Sadira Samarawickrama for 14 runs on his very first ball, taking Sri Lanka's score to 41-3.
Leg spinner Rishad Hussain gave Mendis his first ODI wicket, that too on his very first ball of the game.
Mustafizur ended Aslanka's counter-attacking innings before Mehdi Hasan Miraz exposed the tail-enders by taking two consecutive wickets.
But Liyanage held one end firmly and ensured that Sri Lanka batted for 50 overs and completed his century off 101 balls by hitting Taskin for a four over cover in the final over.
Mustafizur and Mehdi claimed 2-39 and 2-38 respectively.
The series is level 1-1 after Bangladesh won the first match by six wickets, while Sri Lanka won the second match by three wickets on Friday.