Neutering
Although there is no assurance/guarantee that neutering will entirely eliminate the humping issue, you can try this to reduce the excessive repetition of the same.
We have seen cases where the frequency of humping went down in a neutered dog. This applies to both the male and the female gender.
Additionally, a soft blow with the elbow can also help stop the humping. Make sure it is gentle and does not hurt them. It should only act as a warning sign from you.
Social Status
Dogs are genetically programmed to hump other dogs so as to attain a dominant social status. When this is the case, ignorance is the best option, provided they do not repeat it too frequently.
But in the case of dogs humping humans, the reason may not be dominance. So you would need to check if it is any other factor or not.
Never involve in dangerous training methods to prove that you are superior or alpha. This can cause the dog to physically and mentally exhaust themselves and can prove to be fatal.
Genital Infection or Irritation
Sometimes dogs hump as they suffer from some form of itchiness or irritation around the genitals. As a countermeasure, they will try to rub the infected area around other dogs by humping.
In case you notice this, take them to the vet at the earliest.
Mental Stimulation
Your dog may be exhibiting this behavior due to a lack of proper mental or cognitive activity levels. This can lead to boredom and signs of depression in dogs which can be trouble.
To prevent this, make it a point to engage them in regular attention-enhancing games and dog puzzles that will keep their mental activities at optimum levels.
Providing them toys with food hidden in them can be especially rewarding. A stuffed toy can keep them hooked for hours and make them happy and excited at the end of it when they receive their favorite snacks.
Dogs facing issues like depression and anxiety attacks need treatment. Making them participate in therapy sessions can be extremely rewarding. We have seen many cases where dogs improved from severe cases of anxiety-related issues that included humping. Positive results were shown in a few weeks in some cases.
Peer Socialization
It is imperative to make your dog participate in socializing activities from the infant’s face. This will lay a good foundation for teaching them the right way to behave around other dogs as they progress into adulthood.
You can take them to doggy daycares and in parks/pet stores with other pups present. Leave them alone for a while and let them learn to interact with one another rightly.
At our dog training institute, we make dog socializing sessions part of the weekly plan, and it has helped in the behavior correction of several dogs. The younger they are when they begin to socialize, the better it is for their character development.