There are two things to do to reduce fuel loss, first, as already mentioned here use left/right tank selection to prevent movement from the right tank to the left (the one with the vent).
Secondly, it has always puzzled me as to why at many airfields there seems to be a habit of filling aircraft until they are full when the plan is to do a local trip or circuits. A standard 172 has endurance of 4+ hours, put full fuel in and three big adults and you may well be overweight. I digress slightly.........if you fill anywhere near the top (particularly on a warm day) the cold fuel will then warm, expand and pour out of the vent.
Personally if I need lots of fuel I fill the right tank and "nearly" fill the left then use the left tank first until the trend indicator (fuel guage) suggests a drop before using the right tank.