The two left-arm spinners shared seven wickets between them to rock Sri Lanka's top and middle-order after skipper Dinesh Chandimal elected to bat first.
Razzak, 35, stood out on his Test return to claim four wickets while his younger partner Taijul picked up three.
Roshen Silva was batting on 45 at the break to offer some resistence in two dogged partnerships against a persistent Bangladesh bowling attack, as the hosts left Sri Lanka at 110 -6 shortly after lunch.
Tajul bowled wicketkeeper-batsman Niroshan Dickwella in the next over before he broke a stubborn 52-run partnership between Dilruwan Perera and Silva. Perera made 31.
More From This Section
Paceman Mustafizur Rahman removed debutant Akila Dananjaya for 20 on the stroke of the tea break, ending his 43-run stand with Silva.
Earlier Razzak, who played the last of his previous 12 Tests in 2014, struck three times in the morning session including getting Chandimal for a first-ball duck.
Mendis brought up his 50 in 81 balls with a six off Taijul but Razzak rocked Sri Lanka with two wickets in two balls.