Asking how you kill a Nilbog is like asking how you kill Bugs Bunny. You don't. Offering violence has never once worked for Elmer Fudd and in fact always makes things worse.
When you've attracted the attention of a semi-immortal trickster spirit there's really only two good solutions. One is to join in its revelries until you can train its attention on another more deserving target and then quietly slip away. The other is to prove yourself No Fun At All, either by being impossibly dull or by out-pranking the trickster, although these can be risky because they invite the trickster to escalate their antics. In both cases, the goal is to get the trickster to leave you alone of its own volition. This is the only way to "defeat" this sort of creature.