This can be a sign of an abscessed tooth. If an abscess exists, the infection will build up until it finds a place to drain or the pain becomes severe enough that you go to a dentist.
Some of these are caused from stomach gases. Watch what you eat and drink more water or non sugar drinks during the day and stay away from acidy foods.