Hasan ended unbeaten on 100 after adding an invaluable 172 with Mohammad Mahmudullah (72) to help the home team, which won the toss, fight back from a shaky 193-8.
Fast bowler Fidel Edwards finished with 5-81.
West Indies lead the two-Test series 1-0 following their 77-run win in last week's first Test in Dhaka.