In any level with lava, build a perimeter power path around the lava. This will stop the lava from destroying your base temporarily. You will need to go back once the erosion destroys the power path to repair it, and build a new power path in its place.