As well as with all spells in the game, you can counter it by taking away the capability of using the components of the spell. In the case of Hideous Laughter, you can avoid it by restraining the caster's hands, silencing them, or destroying or robbing its material component. It is also a concentration spell, so an ally can end the effect by punching the caster. Lastly, you can find a way to make the caster use the spell on the character with the highest Wisdom Save. You can bluff, provoke, or find another way to trick the enemy.