To get a pet to level 20, it is a similar process to levelling up your troops. You need multiple copies of the card to get your pet to the top rank in order to be able to get it to the highest level. To increase a pet’s level, you also need pet food instead of souls, but these are easy enough to obtain from various events that you will probably have enough stashed in your inventory.
The best way to do this is to save up a tonne of gems and when a pet rescue event occurs, buy all the guaranteed pet baskets that you can. This will give you enough to get it to the top rank. Then just use the per food to get it to the top level and you are done!