Vitamin D deficiency is a global concern for vegetarians as most of the vitamin D‐enriched foods are of animal origin. Pleurotus florida is an excellent source of ergosterol, which gets converted into vitamin D2 under UV exposure. The objective of this study was to optimise UV‐B intensity (1.00–2.50 W/cm2) and exposure time (20–120 min) for maximum ergosterol conversion to vitamin D2. The optimisation studies indicated that exposure with intensity (2.00 W/cm2) for 60 min showed maximum vitamin D formation. The analysis of different nutritional parameters revealed no significant impact on total soluble proteins while a significant increase in total phenolic and total flavonoid contents was observed. On the contrary, a significant reduction was observed in riboflavin content of P. florida. Overall, P. florida exposure to UV‐B is a sustainable approach to enhance the vitamin D content for the development of fortified mushroom products or dietary supplements.