The electrostatic repulsion between metal nanoparticles has an important effect on the colorimetric assays based on the aggregation of nanoparticles. In this work, an Hg2+ colorimetric sensor based on silver nanoparticles (AgNPs) was used as a model system to study the effects of electrostatic repulsion. Adenine nucleotides carrying different numbers of phosphate groups, adenosine monophosphate (AMP), adenosine diphosphate, and adenosine triphosphate, were used to functionalize AgNPs, respectively. Three kinds of AgNPs displayed different responses to Hg2+ ions due to the difference in electrostatic repulsion force, which is resulted from the varying of the number of phosphate groups. The density of negative charges on the surface of AgNPs exhibited a great affect on the size of the AgNPs, detection sensitivity and response range for Hg2+ ions. On these bases, the AMP-modified AgNPs were developed into highly sensitive colorimetric sensor to determine Hg2+ ions in aqueous solution, which showed a high sensitivity of 0.5 nM and excellent selectivity for Hg2+. The Hg2+ levels in water samples were determined using AMP-AgNPs with satisfied recovery. The studies on the role of electrostatic repulsion in the colorimetric assays will facilitate the development of more sensitive colorimetric sensors.