It takes extra calories to build muscle but this does not mean that you can eat whatever you like whenever you like, as you will just gain fat and not muscle. It is with the assumption that you are training correctly and steadily increasing the speed of your metabolism.
The first thing you need is a plan on how you are going to do this and it starts with knowing how many calories your body needs to sustain itself. Once you know how many calories you need every day to build muscle from intense workout sessions you can then start adding a little more calories slowly.
If you need 3000 calories a day to train and do your normal daily activities eating 4000 calories will only gain fat and hide any new muscle that you might have put on with your hard training. It needs to not only be done slowly but also making sure that any extra calories you are having are all good quality calories.
Good quality calories do not come from junk food as they are all fried and just add fat. Good quality comes from increasing your carb intake by increasing the vegetables that you eat like sweet potatoes or kale. You also need to make sure that you are always eating at least 6 different times during your day in order to speed up metabolism.
Eating good quality food every 3 hours will only come from planning correctly and not grabbing a burger and fries cos you did not plan the next meal. There is a general rule of thumb which says that you should eat to gain muscle without adding fat is 1.5 grams of starchy carbs for each pound of body-weight that you have.
So if you are 200 pounds you would need to eat a total of 300 grams good quality complex carbohydrates every 3 hours. It is going to be best to consume the biggest meal of the day within 4 hours after your heavy workout. It is during this period when your body is at its most sensitive to any insulin floating around and to avoid any extra calories being deposited as fat.
The last point is to make sure that you are always eating high quality whole foods that are not processed. Your proteins should be in the form of tuna, whole eggs and chicken while your fats should come from oil and fish oil, peanut butter and avo. Carbohydrates from brown rice, oats and brown pasta while your fruits and veggies from bananas, spinach, apples and broccoli.