The standard local density approximation and generalized gradient approximations fail to properly describe the dissociation of an electron pair bond, yielding large errors (on the order of 50 kcal/mol) at long bond distances. To remedy this failure, a self-consistent Kohn-Sham (KS) method is proposed with the exchange-correlation (xc) energy and potential depending on both occupied and virtual KS orbitals. The xc energy functional of Buijse and Baerends [Mol. Phys. 100, 401 (2002); Phys. Rev. Lett. 87, 133004 (2001)] is employed, which, based on an ansatz for the xc-hole amplitude, is able to reproduce the important dynamical and nondynamical effects of Coulomb correlation through the efficient use of virtual orbitals. Self-consistent calculations require the corresponding xc potential to be obtained, to which end the optimized effective potential (OEP) method is used within the common energy denominator approximation for the static orbital Green's function. The problem of the asymptotic divergence of the xc potential of the OEP when a finite number of virtual orbitals is used is addressed. The self-consistent calculations reproduce very well the entire H-2 potential curve, describing correctly the gradual buildup of strong left-right correlation in stretched H-2. (C) 2003 American Institute of Physics.