You could apply a volume envelope in post-production to raise up the quiet, acoustic sections while leaving alone the louder portions. What audio editing software do you use?
Edit to add: In recordings with very broad dynamic range, there's not much you can do while recording. Set your peaks appropriately - approaching, but not reaching, 0 dBFS, ensuring you leave some headroom so you don't clip - and record away. If parts of the recording are too quiet, you may raise them up as noted above.