Most image processing applications, including Photoshop, have tools known variously as 'Hue-Saturation-Luminance', 'Hue-saturation-Brightness', or 'Hue-Saturation-Value' which allow users to adjust the hue, saturation, and brightness of around eight different slices of the color wheel individually of one another. Photoshop calls it the HSL tool.
One can also use a luminosity mask to isolate a particular brightness range and then make adjustments to only the selected portion of the image with no effect to the masked portion of the image. Many image processing applications now have automatic selection based on luminance, so you wouldn't need to manually draw a mask. I don't use PS to know what they call the tool, but I'd be very surprised if they haven't incorporated it when Capture One, On1, etc. have all had it for a few years now.
Or you could use the curves tool to pull the shadows and highlights down without affecting the parts of the image with midrange brightness.
You haven't really given us enough to go on to help you decide which of the above strategies might work best for your particular image and what you're trying to do with it.