You can judge your dog's condition by placing your hands on each side of his rib cage. Your dog may be too thin. That's the sign of ideal weight. If you can't feel the ribs easily, your dog has no waist and his abdomen drags, he's too fat. Your veterinarian can help you evaluate the finer points of your dog's weight.
Dogs gain weight for the same reason that people do.
They eat more calories than they use. Most owners are gone all day, and come home too tired to play with the dog. Owners may give frequent high-calorie treats. Losing weight isn't easy. Changing your habits and your pet's is the key.