I don't know if this idea has been proposed before, and my guess is that it probably has, but it's not the most common explanation. My idea is that yawning is a way of communicating your mood to others. We smile/laugh when we are happy, cry when we are sad, so why not yawn when we are tired? That would explain why yawning is contagious, since smiling is also contagious. It would also explain why I rarely yawn when other people are not around.
What do you think? Is there any way to test this idea?