I cannot stress enough that there is a safe and effective way to gain weight as well as a dangerous and ineffective way. I have seen way to many guys go about it the wrong way.
Lots of guys think that gaining weight will be fun. They think of all their favorite greasy foods and then imagine eating massive quantities of them everyday. Burgers, ice cream, Alfredo sauce, candy, you name it. But the simple fact is that this food is junk and if you scarf on it your body will turn to junk.
In order to safely gain weight you need to follow a plan that is approved by a doctor and which contains a range of high carbohydrate foods and a limited number of high fat foods. You can find lots of great plans online. But don't just start pigging out. That only gets you a big gut and a heart attack.