First of all, have a vet check him out for any underlying cause, such as ulcers, worms or sharp teeth. Then, I would get him on a diet with free choice grass hay, such as Timothy or Orchard, and feed a high fat and fiber diet, but not a high sugar diet. I would recommend stabilized rice bran and beet pulp, and a couple pounds of Alfalfa will help. Sugar can help gain weight, but you have to feed a lot of it and it is like feeding a kid candy bars (or Sweet Feed or COB to a horse), it is an extremely unhealthy way to gain weight on your horse. Make sure you introduce the grain into his diet slowly, suddenly jumping all this good quality feed onto a malnourished horse is an easy way to cause colic, or even kill a horse.
“Good things come to those who wait… greater things come to those who get off their ass and do anything to make it happen.” - Unknown