Most of the people I meet ask for my advice about how to lose weight, but some of my clients are actually trying to pack on pounds, and it's not as simple as it may seem. Every once in a while I'll read about an actor who had to gain weight for a role, and they talk about how awesome it was to down pints of ice cream, pasta, bread, cheeseburgers, and doughnuts. That's one way to gain weight, but it's not the best way. (Related: More Women Are Trying to Gain Weight Through Diet and Exercise)

I sometimes work with clients who've lost weight due to dental surgery, a digestive problem, stress, or an illness, and are trying to get back to a healthy weight. And as a sports nutritionist, I also work with pro athletes who tend to lose weight over the course of a grueling season. In all of these cases, the goal is to gain weight while optimizing health-and there's a science to it. After all, the old phrase "you are what you eat" is absolutely true-nutrients from food are literally the raw materials your body uses to construct new cells. A junk food–filled diet devoid of nutrients doesn't give your body much to work with. I always say it's like constructing a house with cardboard and tape instead of bricks and mortar. In other words, it's not just about calories.

Here are five "good gain" rules I share with my clients:

1. Don't let more than four hours go by without eating.

Your body needs a continuous supply of energy since it's like an engine that's always turned on (your heart is always beating, blood is circulating, your brain and muscles are working). When you skip meals, you deprive your body of the fuel it needs to keep going. The result is a dip into your energy piggy bank, which unfortunately includes muscle mass. The best way to prevent your body from losing any important tissue is to eat regular meals, spaced about three to five hours apart. If you're trying to gain new muscle tissue, meal timing is especially critical. Sometimes my clients tell me they "eat all the time," but when they actually start keeping a food journal they realize just how erratic their patterns are. Consistency is key. (Related: The Muscle-Building Foods to Eat for More Definition)

2. Eat several foods at once.

Always aim for at least three food groups. Instead of just a banana or a handful of nuts, top a few slices of whole-grain toast with almond butter and banana slices (which, BTW, is Khloé Kardashian's go-to post-workout breakfast), along with a glass of organic skim milk or a milk substitute. A wider variety provides your body with a broader spectrum of nutrients to work with throughout the day.

3. Eat healthy, but dense foods.

The best way to rack up extra nutrition without having to eat huge quantities of food or resort to junk is to choose nutrient-rich foods that pack a lot of carbohydrates, protein, or fat into a small serving. Dried fruit is a great example. With the water removed, the portion shrinks by about 75 percent, so a cup of grapes turns into a quarter cup of raisins. Just be sure to look for dried fruits with no added sugar or preservatives. For another nourishing, power-packed snack, fold rolled oats, dark chocolate chips, and minced dried fruit into almond butter. Spoon out portions about the diameter of a quarter, roll them into little balls, wrap in waxed paper, and snack on them throughout the day. (Related: 3 Easy-to-Make Protein Ball Recipes That Will Replace Those Boring Bars)

4. Drink your food.

Liquids aren't as filling as solid food, so when you're trying to gain weight, they can add nutrition without making you feel stuffed or bloated. Good choices include 100 percent fruit juice, organic skim milk or milk alternatives (such as organic soy, or hemp), and smoothies. Smoothies are ideal (over milkshakes) because you can bolster them with all kinds of good stuff, like wheat germ, nut butter, carrot juice, and protein powder. (Try Emma Stone's high-calorie, post-workout smoothie for gaining lean muscle.)

5. Eat right before bed.