Hard to say from your description, but
Gummi Pflege applied to the sunroof gasket may address your sunroof noise...
Gummi Plege is the product BMW dealerships will use to recondition rubber gaskets and body seals.
If this doesn't address it, your sunroof rails may require lubrication....