To beat gym leaders, try to keep a balance of types in your party pokemon, i myself am a collector, and had atleast 100 of the 180 pokemon yet revealed in my Pokedex AFTER beating the elite 4, so whenever the situation arised i would train a certain pokemon to a crtain lvl, then go to the gym with a good type advantage