The best way to gain muscle is by following three simple steps.
1) Training - weight lifting (check out http://www.musclehack.com for great exercises) will give you the greatest results; body weight exercises (push-ups,pull-ups,sit-ups,etc) are good in the beginning but won't suffice in the long run (yes, gaining muscle takes time).
2) Eating - eat high protein foods (chicken, meat, eggs, fish, broccoli,etc.), if you're very skinny, eat lots of food. If you're a little chubby try to eat at maintenance level (what you need to eat to neither gain nor lose weight) and train. Just don't overeat. Your body can only use a part of your energy intake for muscle growth. Eat a nice protein-rich meal after training (e.g. protein shake and a banana or a tuna sandwich). I recommend http://www.stronglifts.com as a great resource for healthy food options and ideas.
3) Resting - muscle grows when you rest, not while training. After training for a while you will know how much rest you need before working out again. I recommend training 3 days a week and resting at least 1 day in between.
Follow these simple steps and you will most certainly gain muscle.