The Stunned condition seems to be incredibly powerful.
Are there any ways to end it with magic, magic items, abilities, or prevent it from occurring in the first place?
Role-playing Games Stack Exchange is a question and answer site for gamemasters and players of tabletop, paper-and-pencil role-playing games. It only takes a minute to sign up.Sign up to join this community
There is at least one spell that can remove the stunned condition: power word heal. It is 9th level, however.
I couldn't find any spell, class feature, or monster ability that could inflict the stunned condition automatically. All of them only apply the condition if an initial saving throw is failed. Anything that improves or gives advantage to those saving throws will thus help prevent the stun from occurring.
Aura of purity is such a spell; it doesn't remove the stunned condition, but does bestow advantage on saves against it.
Some stun effects, like the Monk's stunning strike, an otyugh's tentacle slam attack, an allip's howling babble, or a siren's stupefying touch, don't end on a save; they just end on the next turn.
The stun effect of the divine word spell is the same, except it lasts for an hour(!) with no chance of ending it early if the initial save is failed.
It can be used to transform into a creature that is immune to the stunned condition.
This naturally helps prevent stuns from being applied but it is debatable if it works to remove the condition from an already stunned creature.
You can easily find a list of available creatures meeting this criteria in this dnd-beyond search