Stomach pain in the middle of the night is mainly caused by dietary factors and stomach acidity. If it is caused by diet, you may have eaten too much or too much the night before, or eaten food that is not easy to digest, and when you sleep at night, your gastrointestinal tract keeps moving to digest food. If it is caused by diet, you can rub your abdomen with your hands or apply hot compresses to your stomach, and then you can take drugs that promote gastrointestinal motility such as domperidone, mosapride and digestive enzymes that promote digestion. If it is caused by stomach acid, because at night when sleeping, stomach acid can continue to secrete, and there is not too much food in the stomach can be digested to cause stomach pain, you can take drugs to neutralize stomach acid such as Daxil, or drugs to inhibit the secretion of stomach acid, such as rabeprazole.