This used to happen to me all the time during school vacation. I found 3 ways for me to deal with this problem:
1. Get something to do. When I would play with my Xbox for hours straight, I wouldn't eat out of boredom, because I wasn't bored. Make sure you always have something to do that interests you and eats some time, even if it is video games.
2. Set up a plan what of what you will eat. Keep track of every single thing you put into your mouth and when you do it. If you have enough time to eat out of boredom, then you have enough time to do this. Once you've done this for a week you can go back and analyze your problems. This made me so much more aware of what I was eating and how much, which lead to me being able to effectively identify when I was snacking too much.
3. This might sound strange, but it does help: Don't keep easy food in the house. For a while, I would only buy food which needed to be prepared, like chicken, frozen veges or frozen rolls. Often when I went to the fridge this happened: I opened the fridge out of boredom, only saw foods which required some time and effort to prepare, closed the fridge, went back to my room.
Hope this helps