What function to apply to a signal to expose its burstiness (i.e., make the burst part more evident than the non-bursty part)
You can apply a simple moving average filter and based on the result of the filter make a decision if you are in the sparse area or dense area, as your average will certainly be larger in your dense area. There is a resolution vs false alarm trade space that you will need to make; your result will be more accurate the longer you can make your moving average filter but your precision in determining where the transition occurred wil be reduced.

So in this sense, to compare to what you tried, instead of determining how far each signal is from the mean, take the mean over shorter intervals (as you move through the sequence), and based on the result of the mean compared to a threshold, decide if you are in the sparse or dense area, and if your decision is sparse, you can clip the result as you have done.

An alternate and simple algorithm would be a window counter, where you allow a certain number of counts (window) between samples above a certain threshold: if the sample comes in above threshold before the count is up you declare a positive, and if not you declare a negative and the count in reset. Further, a certain number of consecutive positives or negatives is required to change state between dense and sparse (this adds hysteresis and avoids a chatter). I don't know the detailed characteristic of your dense to suggest actual count intervals, but this is something you can consider playing with.