Within the framework of density-functional theory, the basis-set convergence of energies obtained from the random-phase approximation to the correlation energy is equally slow as in wavefunction theory, as for example in coupled-cluster or many-body perturbation theory. Fortunately, the slow basis-set convergence of correlation energies obtained in the random-phase approximation can be accelerated in exactly the same manner as in wavefunction theory, namely by using explicitly correlated two-electron basis functions that are functions of the interelectronic distances. This is demonstrated in the present work.