Safe to have sex?

So I’m 22 weeks and haven’t had sex my whole pregnancy. Just been “helping” my guy in other ways lol. Not to be TMI but I really am getting the urge to have sex and feeling very frisky. Is it safe to have sex or masturbate at this stage of pregnancy? I know that may be a dumb question but I keep reading online that even masturbation during pregnancy can make you go in to early labor by making uterus contract etc. Too embarrassed to ask my doctor lol just need some advice from you ladies.