Bhishma suffered such intolerable pain because Bhishma ate food from Duryodhan’s house; meaning, food that was made from wealth earnt immorally. Bhishma knew that Duryodhan was wrong and unrighteous, yet he joined forces with him.
Do not earn wealth by unrighteous or the wrong means. The food eaten from such wealth has a hugely negative impact on you. Similarly, you are causing great damage to yourself if you eat in a party at a house of someone earning/who has earnt wealth by the wrong means. You will suffer. If Bhishma had to suffer, then who are we in comparison, when we are not as pious as Bhishma?
Siding with unrighteousness is wrong. Bhishma was bound by his oath of protecting the Hastinapur kingdom, hence he continued to side with Duryodhan despite knowing very well how unrighteous Duryodhan was.