I'm also lactose intolerant. Protein shakes usually contain lactose. I think Ensure and Pediasure also contain lactose tho I'm not sure. I'm also allergic to soy and most of these also contain soy.
I have found off brand protein shakes that do not contain lactose. They taste awful to me. I can't remember brands. I just read the labels.
Although, I bloat up with gas and am terribly uncomfortable when I drink milk, I've been able to eat cheese all of my life. Many lactose intolerant people find this to be true. And I've begun taking a supplement named Digestive Advantage, Gas Defense Formula, which allows me to eat some ice cream.
I also recommend that you take probiotics to improve your over all health. I've recently found one that works well for me. It's a Vitamin World product called Multi-Enzyme Digestive Care.
I've found over the years that when my digestion works well I feel better and don't lose weight. I've had times when I lost weight and it was of concern to my doctor.
If you're not allergic to soy there is a frozen ice cream like desert found in the ice cream section that does not contain lactose.
I would eat as many and as much high calorie foods as possible. Snack all day. Avocado comes to mind. I can tolerate butter. Slather on butter or margarine 1/4" thick on bread. I love the taste of both. Top everything sweet with Cool Whip. Eat lots of cookies, cakes, and pies made with whole grains, along with the really healthy stuff. Slather butter or margarine on your vegetables. Fry your portion of meats in olive oil. You can get olive oil based margarine if you're concerned about unhealthy fat intake. Olive oil as well as some other fats are healthy.
Once you gain the weight you can stop using so much fat. If heart disease is prevalent in your family perhaps you'll not want to use so much fat. I'm all for healthy eating. I'm 66 and have eaten lots of fat in my younger years. I don't so much now. Still my cholesterol and triglyceride levels are normal. my parents and other relatives lived into their 80's with no heart or stroke conditions. So check on those things before you over load on fat.
I think that increasing your fiber intake might help. Fiber keeps the food in the intestines longer so that your body might be able to absorb more nutrients. If I remember correctly having insufficient nutrient absorption goes along with being underweight.
I recommend that you talk with a nutritionist or dietitian. You can find one at your local hospital. They offer classes in weight loss. Call and ask them about gaining weight.
Definitely eat lots of calories.