Mominul Haque hit an unbeaten century to steer Bangladesh to a draw in the second and final Test against Sri Lanka in Chittagong on Saturday, leaving the tourists with a 1-0 series win.
Bangladesh, who needed to bat out their second innings after being set an improbable victory target of 467, were 271-3 when stumps drawn on the fifth day at the Zahur Ahmed Chowdhury stadium.
Mominul, a 22-year-old left-hander, held the innings together till both sides accepted the draw as soon as he reached 100, his third Test hundred, the post-tea session.
Shakib Al Hasan returned unbeaten on 43 as he and Mominul added 120 for the fourth wicket after Bangladesh were 151-3 before tea.
Sri Lanka, who won the first Test by an innings and 248 runs in Dhaka last week, failed to dislodge the hosts who appeared determined to salvage their battered reputation.
It was only the second draw in 16 Tests between the two countries, with Sri Lanka having won the other 14 matches, eight of them by an innings margin.
Bangladesh, who languish at the bottom of the Test rankings at number 10, have lost 68 of their 83 Tests since gaining full status in 2000, winning just four.
Bangladesh captain Mushfiqur Rahim said he was delighted with the draw and hoped the momentum gained by his side will spill over to the limited-overs contests.
"Such a performance was badly needed," he said. "The boys stuck to the task and delivered. Especially with the bat, with Imrul and Shamsur in the first innings and Mominul in the second.
"We may have lost the series but I am very happy at the way the team applied themselves. I hope we can carry this momentum into the one-day and Twenty20 series."
Bangladesh and Sri Lanka will play two Twenty20 matches in Chittagong on Wednesday and Friday, before starting a three-match one-day series in Sylhet on February 17.
Sri Lankan captain Angelo Mathews said it was difficult to force a win on the slow pitch.
"Bangladesh batted well and really improved from the last game, but I think we could play another Test on this wicket right now," he said.
"The pitch did not do much and there was nothing for the bowlers in it once the ball became soft."
Sri Lanka's Kumar Sangakkara, who joined Englishman Graham Gooch as the only batsmen to score a triple-century and a century in the same Test, was declared both the man of the match and the player of the series.
"I think the wicket was pretty good to bat on, and my job was to score as many runs for the side as I could," said the 36-year-old veteran, who made 319 in the first innings and 105 in the second.
"When a batsman walks out, the main idea is to bat long and make sure there is a foundation upon which the team can build and that's what we did.
"It is my first triple, so that's special. Hopefully, I will play a few more Tests before I call it a day. My career is probably in its twilight (years). So a few more Tests and a few more wins, and I will be very happy."
As Bangladesh batted out the draw, Sri Lanka missed spin spearhead Rangana Herath and seamer Shaminda Eranga, who both flew home before the Test to recuperate from injuries.
Perera was the most impressive bowler for the tourists, conceding just 55 runs in 28 steady overs for his two wickets.