بسم الله الرحمن الرحيم
Such dreams come due to stomach problems. Eat little in dinner and recite at least half Para (of Quran) before going to bed. Also recite Surah Quraish thrice after each salah with durood 3-3 times before and after and blow it on your hands and pass your hands over your body. Also develop the habit to sleep with wudhu according to Sunnah.
Allah knows Best!
Darul Uloom Deoband
This answer was collected from the official ifta website of Darul Uloom Deoband in India.