How to relieve heartburn during pregnancy?

I’ve been having really bad heartburn that wakes me up at night. I try my best to eat well but I really am not sure what causes heartburn in the first place.