I would feed your dog any brand of quality food ....whatever your dog like! If he likes his food he will gain weight. You can also offer him lean cuts of meat ...the protein will build up muscle. I would also have a vet check his stool for worms.
Depends on the breed, sometimes thats the dog´s constitution. Take your dog to the vet and they´ll let you know if it´s on its ideal weigh or not. Also, pets might get skinny due to internal or external parasites.