Weight gain has nothing to do with calories in calories out. It is controlled by blood sugar and insulin. Read the book "why we get fat" about how our bodies work if you want to learn more.
You get bigger if you eat more and you get smaller if you eat less. It's important to get all of fat, carbs, and protein for a balanced diet. Not saying that there isn't anything more to it, but for most people it really is this simple.