Protons repel one another electrostatically, and the closer they get to one another, the greater the repulsion. Neutrons and protons attract one another through the strong nuclear interaction (or residual effect of the interaction that keeps quarks bound in neutrons and protons). The nuclear attraction between two protons is not quite strong enough to keep two protons bound together against the electrical repulsion, but with the addition of a neutron or two, there is more overall attractive force to overcome the repulsion.
For nuclei with more and more protons, the repulsive forces grow more than the attractive forces do, as the repulsive forces have much greater range than the attractive forces. To form stable or nearly stable nuclei more than one neutron is needed per proton to provide the attractive force needed.