As we move across a period in the periodic table from left to right, the number of protons in the nucleus increases by one for each successive element. This leads to an increase in the positive nuclear charge. While the nuclear charge is increasing, the electrons are added to the same outermost shell.
The stronger nuclear charge exerts a greater attractive force (electrostatic pull) on the electrons in the outer shell, pulling them closer to the nucleus. Because the number of electron shells does not change within a period, this increased pull is the dominant effect, causing the atomic size (radius) to decrease across the period.