If the question "May I pet the dog?" means "May I stroke the dog gently?", then none of the phrases you obtained from your sources look good.
「可愛{かわい}がる」 comes closest, but it is not really appropriate. The other two 「飼{か}う」 and 「ペットにする」 are simply out of the question. I will try to explain these verb choices later.
My own recommendations as a Japanese-speaker would be:
「なでてもいいですか。」
「軽{かる}く(or ちょっと)なでてもいいですか。」
「なでさせてもらってもいいですか。」
The verb here is 「撫{な}でる」 ("to stroke gently"). We would not use 「犬を」 at the beginning as it is another person's dog. Many of us would actually use 「ワンちゃんを」 instead. Using the plain 「犬」 in this situation could make you sound fairly cold and/or indifferent.
If you and the dog-owner, however, have already exchanged some words about the dog, you do not need to use an 「object + を」 at all. The dog-owner would not think that you were wanting to pet him/her instead of the dog. Japanese is a highly contextual language.
The problems with the phrases you have found:
「可愛がる」: A little too broad a word. It basically means "to treat with love/care". That is not quite the word you would want to use. It would make the dog-owner wonder what exactly it was that you were wanting to do with his/her dog.
「飼う」: That means "to keep (an animal at your home)".
In essence, therefore, you would be saying "May I take your dog home with me?" You will sound like the weirdest foreigner.
「ペットにする」: This means "to make an animal one's own pet". It is just out of the question as 「飼う」.