Dieting (especially losing weight) can seem like an esoteric process that only those with an amazing support system or phenomenal genetics can obtain. The fact of the matter is that dieting in any capacity (to lose weight or gain weight) is a process. Processes have techniques and methodologies that make one more successful in the achieving the goal of the process.
As with any goal, you need a quantitative measure to track progress. For both weight loss and gain, calorie tracking and weight tracking are cheap, easy ways to monitor progress. My Fitness Pal is my personal choice for tracking calories. It was the first one I found and works pretty well. A $20 scale is how I weigh myself every morning. Be consistent with tracking weight; don't weigh yourself in the morning one day before you use the toilet, another day after you use the toilet, and another day at night. It doesn't work well. In my experience, weighing yourself right out of bed after peeing is the most consistent way to measure weight. When I first starting my own weight gain, I used JMP software (for statistical analysis) to perform a variation study on times of the day for weight measurement. The morning yields the least variation for me, and it seems to work well for others.
Timing your meals can be helpful for either diet scenario. If you're trying to lose weight, plan the majority of your calories for when you're not busy. When you are busy, you won't think about your hunger much. When you're not busy, you'll have calories to eat that won't put you over your daily limit.
Conversely, if you're trying to gain weight, eat when you're not full and depending on how you handle it, not too close to when you sleep. For three months, I drank a gallon of whole milk a day to gain weight (on top of other foods), and I found it was affecting my sleep. I would wake up at 2am and 6am to pee every night. I stopped drinking so close to bed, and that helped me not wake up. Some people like to eat many small meals often, but others find that eating a few large meals works better. See which works better for you.
Milk and Peanut Butter
I personally find gaining weight to be more difficult than losing weight, but it's doable. I have heard the following repeatedly: "I can never gain weight. I've tried everything, and I eat a ton, but I can't seem to gain weight." My immediate question following this is always "how many calories are you eating a day?" The person will generally respond to this effect: "A ton: like 3,000 calories." That is not a lot. Try 4,000. Try 5,000. At some point, you will gain weight. This might mean two or three protein shakes a day, each with whole milk, a scoop or two of whey powder, and two to four tablespoons of peanut butter a day. But god damnit, you're not eating enough.
Fish, Chicken, and Vegetables
To lose weight, nothing works better than high protein foods and low calorie vegetables with high fiber. Fish and chicken have low calories and are almost entirely protein. You may be able to eat three or four thousand calories in cheesecake, but try to do the same with chicken and you'll likely quit before you hit one thousand calories. Vegetables are also low in calories, but have relatively high volume due to their fiber content. 500 calories of leafy spinach is about 5lbs of spinach. You're not going to finish that and be hungry like you will with 500 calories of chips.
Throughout this entire process, you should see what works and what doesn't. Let's say you're trying to lose weight. One day you're really hungry toward the end of the day. Think back to what you did that day. Did you eat all of your calories at the beginning of the day? Did you eat too many chips and not enough fish? Maybe you've had a great week, and you're not sure why. Did you eat a lot of chicken and vegetables? Were you active and busy all week? Ask yourself these questions and change your habits based on what you conclude. All processes require iterative refinement: making improvements at each event of failure and success. Failure is just an opportunity to learn.
Remember that all skills need to be improved and learned. Tracking progress, timing your meals, and focusing on what worked and didn't will improve your ability to diet effectively. Whether you choose to gain, lose, or maintain weight for whatever reason, being effective and analytical will allow you to achieve your goals and have control over your life.