Accidental farts during sex

Sometimes when my boyfriend and I have sex, a fart comes out and it's so embarrassing.  He's a good sport about it but I am mortified, especially when it smells. Does this ever happen to anyone else? I'm too embarrassed to ask my doctor. I've tried Gas X but it doesn't seem to help. Any other ideas?