Make sure you have the right litter box and litter. You'll want your cat to see his litter box as the most beautiful place in your home. Make sure it's filled with litter he likes and is located in a quiet area.
Thoroughly clean your bedding. Unsurprisingly, your cat will pee where he smells pee.
Make the places he's having accidents unattractive. Until he gets
accustomed to using his litter box, make the bed an uncomfortable place to
urinate. You can put something non-absorbent on it when you aren't sleeping, like a shower curtain.
Change the meaning of your bed. If your cat is confusing your bed with his
bathroom, start to make him see your bed differently. You can begin by playing
with him on it and giving him treats there so that he begins to associate it with
food.
Be patient. Some cats take up to a month to consistently use their litter box