If this is something ongoing, then it could probably be GERD. (and not just something brought on by eating spicy foods, etc...)
Ongoing acid reflux (GERD) can be a serious problem. So, I would recommend that you see a doctor (preferably a specialist) if you have not seen on already.
My MIL has GERD (hers is genetic.. faulty flap/valve where the esophagus and the stomach meet) And, she did develop esophogeal cancer. This is one of the least curable cancers, and is very deadly. At the stage where they discovered hers, she is very lucky to be on of those who beat the odds!!! She has been fine ever since she underwent treatment a few years ago.
Onset at night, when lying down, is a classic symptom of this. My MIL bought one of those electronic adjustable beds, which she keeps the upper section elevated.. more like one might do when reading in bed... but this is how she sleeps. Before that, she sometimes slept in a big recliner when her GERD was bad.
Of course she has been on prescription acid blockers, probably like the ones mentioned by previous posters.
I think it is recommended that a person with GERD should take thier medication every day, and not wait until they get the bad heartburn, to avoid the damage (and possible cancer) in the esophagus.