Wish can be "passed" to another Pokemon. This means that you use Wish and then the next turn you switch out, the Pokemon you switch to recieves the healing benefits, the healing benefits being recovering health equal to half the HP of the user of Wish. From something like Chansey or Blissey, this essentially gives your Pokemon another chance to sweep. This is also helpful for negating the effects of hazards.
Moonlight heals half of the users HP in ordinary situations, although 1/4 is healed in all weathers except for Sun. In Sun, your HP is healed by 2/3 of your total HP.
Wish is usually the better move. Sun is number three for weather usage, after Rain and Sand. For about 40% of battles you are in in OU (percentage of Politoed+Tyranitar+Hippowdon+Abomasnow+base forms use, and rounding works very well when also taking into account Swift Swim Rain teams), Moonlight's healing will be cut down to 25%. Wish on the other hand only has a one turn delay, which can be easily fixed by the standard Wish+Protect combo. Of course, this is predictable and will likely have a foe using a stat booster on the Protect turn, so you can then use that to your advantage and strike back.
It is also worth mentioning that Wish has double the PP of Moonlight, meaning that it is not as easy to stall out.
In the lower tiers of UU and below, Moonlight can be considered over Wish due to lack of weather inducing abilities. The PP problem is still there and Wish still has the health passing capabilities, but Moonlight is instant reliable recovery. You have to decide whether you'll be more likely to need healing in one turn, or would rather have better capabilities of dealing with stall and also having team support.