Sri Lanka was set a revised target of 245 in 40 overs, meaning it needed 119 runs from the final two overs.
Sri Lanka needed five wickets for victory on the final day and Jayawickrama accounted for three of them to finish with combined figures of 11-178.
While Sri Lanka won the two-match Test series 1-0, Jayawickrama returned with five wickets while Mendis scalped four wickets for the hosts in the second innings.
An unbroken 150-run third-wicket stand between Najmul and Mominul took Bangladesh to 302/2 at the end of the opening day's play.
It's been a long time between test wins for Sri Lanka, a record coach Mickey Arthur has ensured the players are acutely aware of.