My 9th grade Rebbi told us that we have to cover our mouths when we yawn to avoid evil spirits entering our bodies. Is there any source that says this? If not, is there any other Jewish reason, besides basic manners, to cover your mouth when you yawn?
שלחן ערוך סימן צז סעיף א (titled: "שלא יגהק ושלא יפהק בשעת התפלה," "Not to yawn during prayers")
לא יגהק (מוציא מגופו לפיו נפיחה מתוך שובעו, רייטי"ר בלע"ז). ולא יפהק (פותח פיו להוציא רוח הפה) ואם צריך לפהק מתוך אונס יניח ידו על פיו שלא תראה פתיחתו.
Do not burp or yawn [during prayers]; and if one must yawn, one should cover his mouth with his hand so as not to show the opening of his mouth.
That what Shulchan Aruch has to say about it, but in general, I don`t know anything about evil spirits, but I gonna look meforshim on this section of SA.
After a basic review of the sources, I would say that the basic answer to your questions are:
No, there is no source that says that we have to cover our mouths when we yawn to avoid evil spirits entering our bodies. In fact, to my knowledge, there is no source that says that one is required to do so at all except in prayer.
No, the only reason found in Jewish sources for covering one's mouth when yawning is because it is considered bad manners to openly yawn in front of other people. (See Levush and Aruch Hashulchan on OC 77:1, among others.)
Indeed, the reason why we are required to cover our mouths when yawning during prayer (and even this is only permitted if one is unable to stop himself from yawning) is that it is seen as disrespectful to yawn in front of others and we would never do so in front of an important person, so we certainly shouldn't do so in front of God.
The custom of covering your mouth while yawning is common in several cultures, but so far, from searching secular sources, I have not found any such customs or requirements with Jewish origins. In Yawning: comparative study of knowledge and beliefs, popular and medical, O. Walusinski writes:
According to [Pierre] Saintyves, Islam sees yawning as a sign of Satan entering the body, and sneezing as a sign of his leaving the body. [...] "The Prophet told us that yawning is prompted by Satan and gave us the order to avoid it whenever possible. When it becomes inevitable, we must close our mouth with our hand."
Similar practices and ideas exist in India, and later in Europe during the Bubonic Plague where the practice was instead signing the cross in front of their mouth.
Your Rabbi (or the person he learned it from) likely picked up the idea from a source outside of Judaism such as the culture he grew up in. So far I haven't been able to find any reason in Jewish law why one should cover one's mouth, aside from, as you already mentioned, manners (which is a pretty good reason).
Rebi would cover his mouth when yawning during prayers. Brachos 24a-b:
אמר ר' חנינא אני ראיתי את רבי שגיהק ופיהק ונתעטש ורק וממשמש בבגדו אבל לא היה מתעטף וכשהוא מפהק היה מניח ידו על סנטרו
Rabbi Ḥanina said: I saw Rabbi Yehuda HaNasi, while he was praying, belch, yawn, sneeze, spit, and remove [a louse] with his garment, but he would not wrap himself [in his prayer shawl] (if it fell during prayer). And when he would yawn he would place his hand on his chin
It's a din in Hilchos Derech Eretz. It's manners.
Q: Is it true that one must cover one's mouth when he yawns so that his soul doesn't come out of his body? A: Nonsense. It is a superstition with Muslim roots that a yawn comes from Satan. One should cover his mouth, however, because it suggests boredom and is impolite. In actuality, there is no scientific explanation why we yawn. There is, however, an explanation of "Mirror neuron" (why others yawn when they see someone else yawn). By the way, animals also yawn.