Some people do fart in their sleep.
When you sleep your anal sphincter relaxes slightly when gas builds up.
And when the gas builds up and the anal sphincter relaxes then you release that gas buildup which is known as farting.
I know my 2 year old son farts in his sleep because he was sleeping with me on the couch and farted while he was laying next to me.
Thankfully his diaper kept the smell in but I really heard the loud fart he made through the diaper.
I was awake watching TV while he was actually taking a nap next to me on the couch and I heard the fart go against the diaper.
I'm surprised the sound didn't wake him up.
I thought he had pooped the diaper or had explosive diarrhea so I checked his diaper and thankfully it was just a fart.
So yes some people do fart in their sleep and some may fart in their sleep and not even know they did it.