TSA rules allow medically necessary over the counter medication as carry on. Sunscreen is regulated by the FDA as an over the counter medication. I have been able to get larger bottles of sunscreen through as carryon by printing out the TSA rule, showing the FDA notice on the bottle of sunscreen and saying that my dermatologist says that due to a history of skin cancer, the sunscreen is necessary (all true).
YRMV