For a long time scientists thought that contagious yawning was restricted to apes and humans only.
However, recently there have been many peer reviewed studies on contagious yawning. For the most part the studies have set up their methods so that it prevents tension yawning from altering the results. Even then, dogs still yawned contagiously!
Dog's use yawning as a form of body language. They are telling others, ( canine or humans ) that they are stressed about something, and wish to avoid conflict.They also yawn to "self- calm". I have a very excitable and energetic pit mix. Every day while I am preparing to take him for a walk, he controls his behavior by yawning, instead of running around like a crazy dog. In dog parks I have witnessed many times, 2 dogs meeting each other. One or both will yawn and avoid eye contact, as a way to tell the other that they feel anxious but want to avoid confrontation. So, when a dog sees you yawn you may be communicating that you are stressed and mean no harm. When a dog yawns back are they telling you they feel the same, or is it social imitation?