The tourists, who won the first Test by an innings and 248 runs in Dhaka last week, made 587 in their first innings before being all out at tea on the second day at the Zahur Ahmed Chowdhury stadium.
Left-handed Sangakkara's maiden triple century was his ninth 200-plus knock, leaving him in second place behind Australian legend Don Bradman who had 12 scores of 200 or more.
Sangakkara, a 36-year-old veteran playing his 122nd Test, also became the ninth Test batsmen to reach the 11,000-run mark.
Having started the day on 160, Sangakkara hit 32 boundaries and eight sixes before he was last man out attempting to force the pace.
More From This Section
Sangakkara, left with number 11 Nuwan Pradeep at the other end, moved from 286 to 302 with a four and two sixes off consecutive deliveries from left-arm spinner Shakib Al Hasan.
Pradeep contributed just four runs in the 10th-wicket stand of 54 with Sangakkara, who scored 116 in the company of the last three batsmen.
When Sri Lanka began the day on 314-5, overnight batsman Kithuruwan Vithanage helped Sangakkara add 90 for the sixth wicket before the hosts hit back twice in successive overs.