The 31-year-old Jamaican Samuels was 109 not out and added 198 runs for the unfinished third wicket stand with Darren Bravo (85 not out) to help the tourists recover from the early loss of the openers at Sheikh Abu Naser Stadium.
The tourists, who lead the series 1-0 after winning the first Test in Dhaka by 77 runs, are now 146 behind Bangladesh's first innings total of 387.
Samuels, a star in West Indies's World Twenty20 triumph in Sri Lanka last month, drove spinner Shakib Al Hasan towards cover for his 11th boundary to complete his fifth Test hundred -- and his third this year.
By the end of play he had hit 13 boundaries and a six during his 231-ball resistance-filled knock after Kieran Powell (13) and Chris Gayle (25) were dismissed in the pre-lunch session.
Bravo, who hit seven boundaries during his sedate 197-ball knock, helped Samuels set a new record for third wicket against Bangladesh, beating the 179-run stand between Brian Lara and Ramnaresh Sarwan at Kingston in 2004.
Powell, who scored a century in each innings in the first Test, was caught at square-leg off a short delivery from paceman Rubel Hossain, while Gayle was well caught by wicket-keeper Mushfiqur Rahim off spinner Sohag Gazi.
Earlier, Bangladesh added 22 to their overnight score of 365-8.
Abul Hasan, who on Wednesday became only the second man in 135 years of Test cricket to score a debut hundred while batting at number 10, was last man out.
The 20-year-old left-hander hit 14 boundaries and three sixes during his 163-ball knock before being caught in the slips off a short Fidel Edwards delivery.
He fell just four short of equalling the highest ever individual score by a number 10 batsman set by Walter Read for England against Australia at The Oval in 1884.
Mohammad Mahmudullah was dismissed in the third over of the day when he gave Darren Sammy a return catch after scoring a solid 76.
He had helped Hasan add 184 runs for the ninth wicket to lift the home team from a precarious 193-8 on the first day.
Their partnership fell just 11 short of the world record ninth-wicket partnership by South African pair Mark Boucher and Pat Symcox against Pakistan in Johannesburg in 1998.
Mahmudullah hit nine boundaries during his almost three-hour stay.
Edwards was the pick of the bowlers with 6-90, his 12th five-wicket haul in Test matches. Sammy chipped in with 3-74.