Lunar Dance causes the user to faint, but restores the HP, PP and removes all status conditions (except fainting) of the Pokémon that is sent out to take its place. If the user moves before the opponent, the restored Pokémon is then sent out before the end of its turn.
Generation V onward
The receiving Pokémon is now sent out at the end of the turn after all other Pokémon have moved.
Lunar Dance reduces the user's HP to 1, and restores all the HP and PP of team members in the same room as the user. It also removes any status conditions on those Pokémon and breaks any move seals caused by seal traps.
It heals teammates' HP, PP, and bad status conditions, but it reduces your HP to 1.* It restores your teammates' HP and heals their bad status conditions. It also slightly restores their PP. But it depletes your HP to 1, so be careful!*