Eat more sammiches
I lost about 30 lbs. in 2.5 months when I quit drinking/binge eating. Turns out, I never learned how to eat properly. Who knew most people didn't drink a liter of whiskey and eat 3 double cheeseburgers at 3AM every other day? Plus, I'm more active in sobriety than I ever was while drinking. My basal metabolic rate has gone up tons.
It took a couple months of heavy eating and heavy lifting to pack on some weight but now I look less like one of those malnourished kids in Oliver Twist and more like a functioning, adult male.
There are a lot of reasons for being underweight, including the dreaded biological factors. Aside from the doctors, you could talk to a personal trainer about gaining
good weight.
Best of luck