Having sex in Starfield will give you an XP boost.
For those looking to increase their XP, it looks like it would be worth setting yourself up for a romantic experience.
As highlighted on the Starfield reddit (via VG247), players will get a 15 percent XP boost when they sleep with a companion. This little buff is called “Emotional Security”, and lasts for 24 minutes. It is similar but better than the 10 percent well-rested condition, which you can get by sleeping without a companion by your side.