The mass of proton is 1.672 × 10−27 kg while it is 1.675 × 10−27 kg. Both are made up of 3 quarks each. Then what makes proton lighter than a neutron?
Note that the combined rest masses of the quarks (~10 MeV/$c^2$) account for about 1% of the proton and neutron mass (~938 MeV/$c^2$), the main contribution to the mass are the gluons from the Strong Force. Since the composition of the proton and neutron are different, so is the force that binds them.