The melting curve and stability of ammonia (NH3) is investigated up to 40 GPa and 3500 K by x-ray diffraction and Raman spectroscopy in the laser-heated diamond anvil cell. The NH3 samples were directly heated by the 10.6 µm radiation of a CO2 laser to reduce the risks of chemical reactions. Melting was unambiguously detected by the appearance of the liquid diffraction signal upon temperature increase. The melting temperature of NH3 is found to steadily increase with pressure up to 40 GPa, and the previously reported turnover is not observed. As a result, the melting line of NH3 is expected to cross the isentropes of Neptune and Uranus in the pressure range 55-65 GPa, implying the possible presence of superionic solid NH3 in these planets. Our x-ray and Raman measurements confirm the appearance of N2 and H2 upon heating the liquid phase from 6 to 40 GPa. But while the equilibrium 2N H3 N2 + 3H2 balances towards the dissociated elements at low pressure and high temperature, ammonia is found to the more stable species in the range 20-40 GPa, 300-3000 K.