Expanding on kmm's comment, kmm's link references Brainerd at al. (2004) whom conclude:
Yawing is common to all vertebrates and thus only seems to serve the purpose of stretching.
In general, yawing is a sign of high nitric oxide levels. Nitric oxide is also the hormone that results in blood-flow toward the genitals, and thus could just also be indicating that your pet is horny.
However, excessive yawning has been correlated with heart problems, and of course poor sleep (secondary ref here). If your dog does yawn excessively, and it doesn't seem to be correlated with poor sleep / loud snoring, it may be worth it to have them examined by a vet.