One way to stop a dog from doing an annoying behavior is to put the behavior on cue, and then just don't give the cue, or cue the dog to do it so much that he gets tired of it. It's kind of like the people who make teenagers smoke cigarette after cigarette until they get sick... by that point it's no fun anymore and they're less likely to do it on their own.
So with humping, you can reward the dog for humping on cue. Cue him to hump so many times that he gets tired of it, and then stop cueing it.... the chances of him humping on his own after that are much less.
Once you have humping on cue (and under stimulus control, so that he doesn't hump unless cued), you can also use it as a reward. Humping is a very self-reinforcing behavior, and giving the dog the chance to do it could be highly reiforcing.
It's really no different than how I recently taught a dog to jump in my lap as a reward. She loved jumping in my lap, but of course this was not allowed (mostly because she was about 55 lbs!). So I put it on cue, and on stimulus control, and used it to reward really great behaviors. She never did it without being cued, because she knew that if she did the other things I was asking her to do, I'd eventually let her jump on me.