I can tell you from personal experience that gaining weight is easy, but as you get older it's hard as hell to get rid of. Therefore if you want to gain weight make sure it's muscle and don't over do it. This means no 10,000 calorie weight gaining shakes or any other crazy supplements.
Best exercises to gain muscle are dead-lifts and squats, I also love straight leg dead-lifts. I'd get a trainer to make sure your form is proper and then build a solid routine.
I'll link to a routine that I had great success with.