Bangladesh, set an improbable target of 467 to record a series-levelling win, took their overnight score of 12-0 to 91-2 by lunch at the Zahur Ahmed Chowdhury stadium.
Tamim Iqbal and Shamsur Rahman put on 71 for the first wicket, before both openers fell in the space of 10 runs.
Tamim made 31 when he was bowled by leg-spinner Kithuruwan Vithanage, who was bowling for the first time in his short four-Test career.
At lunch, Imrul Kayes was unbeaten on two and Mominul Haque was on four, with Bangladesh still 376 runs away from victory.
Sri Lanka have two more sessions to claim the remaining eight wickets and sweep the series after winning the first Test by an innings and 248 runs in Dhaka last week.
Perera was Sri Lanka's most impressive bowler, conceding just nine runs in 13 steady overs for one wicket.