Limit your dogs amount of water intake before you go to bed. Make sure you take your dog out several times just before bedtime and make sure that he actually goes.
The bed is the 'highest' of positions in the house, so he thinks he's boss and is marking his territory. Don't allow him on the bed anymore and give him a bed of his own and make him sleep there.
Your should try to teach your dog that he has designated places to go potty. At night you should keep him in his crate and let him outside first thing in the morning.