If more people would just train their dogs starting from the moment they brought them home, threads like this wouldn't be posted, and animal shelters wouldn't be so crowded.
Dominance humping is SO easy to stop. And at four months, she/he is at the correct age to start the harder-cored lessons. Water bottles have been suggested and I agree, as well as teaching the dog "OUT!" when she/he starts to do it again. (I've always used OUT! as a "no" command since it more closely sounds like a Momma dog's growl when she's teaching her puppies something as well.
I also agree that at four months, she/he is MUCH too young to be allowed full run of the house. She/he should have been crate trained by now, or at the very least, confined to one room. Crate training also makes it so much easier to housebreak a dog. It also gives them a "room of their own" to go to so they can sleep or just be left alone.
Good luck, and don't, DON'T give your puppy up for something that can so easily trained not to do.