A physically well behaved analytical potential of a diatomic system is constructed based on perturbation theory and a potential correction to the Murrell-Sorbie potential. Alternative formulae for rotational constants and ro-vibrational energies are suggested. An energy-consistent method is proposed for calculating accurate potential energy curves of diatomic states. Applications of this method to the electronic states X 1 g + , C 1 u , a 3 g + , e 3 u + of H 2 , the ground state X 1 g + of N 2 , and the states X 3 g - , C 1 u - , B 3 u - of the O 2 molecule show that the present potential agrees excellently with the known Ryderberg-Klein-Rees data or accurate configuration-interaction (CI) studies, and is better than other analytical and some CI potentials, particularly for molecular electronic excited states.