Protons stay close together in the nucleus because the strong nuclear force.
There are four natural elemental forces: 1) gravity, 2) electromagnetic force, 3) weak nuclear force, and 4) strong nuclear force.
Gravity is an attractive force. It acts at long distance and is proportion to the product of the masses. It is not relevant in the nucleous of an atoms because the masses are tiny.
Electrotmagnetic force may be attractive or repulsive. Indeed, as stated since the protons have all positive charge, this force is repulsive, and you could expect that they the protons cannot stand so close to each other in the nucleous.
Strong nuclear force is the strongest of the four forces in nature and acts only to very short distances. It is the atractive force between the partilces in the atom nuclei. This force overcomes the electromagnetic repulsion between the protons. This force is responsible for keeping the protons and the neutrons together in the nuclei.