You declined "my" correctly in the phrase "to my friend," it is the same concept for any other part of speech.
Собака is a feminine word, so if you are going to use the possessive pronoun "мой" is needs to be feminine (моя) as well since it is describing the dog. Therefore, when you decline собака into accusative case (собаку), any adjective describing it needs to match, thus 'моя' becomes 'мою'.
"I gave my dog to my friend."
"Я дал мою собаку моему другу."
Here is a chart for the declension of "мой"
http://www.study-languages-online.co...ssive-pronouns
Don't be overwhelmed by it, it will look like a lot at first but it becomes much more understandable when you practice, and recognize patterns.