Should one take pills to gain weight? What type of pills are safe for consumption to gain weight.

Not pills. It is preferable to change one's daily caloric intake rather than taking pills. Best to try it naturally first. Keep track of what you're eating daily in a diary. Then, see where you can add calories. A dietician/nutritionist could be really helpful too.