I have terrible spasms in esophagus and leads to afib sometimes. How can I prevent them?

Heartburn. Heartburn or spasms in your esophagus may not be what you think they are, they may be signs of angina, especially if they are assiated with heart dissrythmias. See your dr about a stress test or angiography.