An AGC (automatic gain control) loop comprising a detector, comparator, and gain control element can do that. This is a pretty common function.
In your case the detector should measure the peak-to-peak value which is easy enough. The gain control element could be an operational transconductance amplifier or Gilbert cell multiplier.