Researchers are currently working on developing a pill that relaxes those muscles in the vas deferens that normally propel semen out. And it's appropriately been dubbed the ""The Clean Sheets Pill". Here's more from Techcitement:
It’s affectionately dubbed the “clean sheets” pill due to the fact that it inhibits release of any semen whatsoever by relaxing the longitudinal muscles of the Wolffian duct system while still permitting the circular muscles to contract, resulting in a sphincter action of the circular muscles on the lax longitudinal ones so they clamp down on the tubes carrying sperm and semen. Because all fluids are stopped before emission, that means they remain where they are (no retrograde ejaculation into the bladder, etc) and are recycled by the body as naturally as in total abstinence.
The "clean sheets" pill might prevent ejaculation but it won't diminish pleasure or the sensation of orgasm. So you still have all the awesome sensations of sex without having to deal with the mess (or a kid).

For more on other methods of male birth control being researched and developed, head to RH Reality Check