Programmable differential amplifier
A mux or analogue switch can be used to control amplifier gain by switching in various combinations of different resistor values. 

It is also possible to change the gain of some amplifier circuit topologies by changing the combination of some resistors that connect to GND. With these it is easy to selectively make the GND connections by using small nFETs or NPN transistors. 

Yes it is possible to control such circuits from a microcontroller. As with any circuit, especially analogue circuits like this, you have to make sure that the added circuit connectivity in the amplifier's gain control loop does not add too much extra coupling or feedback to the circuit to introduce instability or oscillation. In the case of the microcontroller connections into the circuit you have to use care to make sure that the possibly noisy digital GND of the MCU does not contaminate the grounds of the analogue circuit and upset the signal quality above an acceptable level.