I have some data that I'd like to create an envelope for it.

As in the picture, the data is always positive and I'm looking for something that will capture my crudely hand drawn red line. It should be eventually possible to predict from the fit model actual points on the line. The shape of the envelope does not necessarily follow any general function. I'm maybe looking for a LOESS-type fit, just for maximum values.
The data itself are the squared residuals from a fit, and I am looking to predict the variance at various x values.