Eating and physical exhaustion


I recently noticed that I can eat literally all food at home when I am physically tired. This was for example when I worked on a project for a week, got up extremely early (e.g. 4:30 am) and stayed awake till 11:30 pm. I felt physical exhaustion, pain in my back, knees, head. After that on Friday or Saturday I worked from home in order to finalize the project and cannot stop eating.
Could you please advise how to cope with this. Thank you!