As others have said this process is called "compression" but that term is also now ambiguous as, with digital sources, it can mean using an algorithm to reduce the size of the data. You may have heard of "lossless" and "lossy" compression. This is an interesting and useful process but not what you want here.
The sense of compression you want is "compressing the dynamic range" and it predates digital music. Prior to the digital era, you would need some hardware device. Today, you can use software.
As replete says in a comment look at the Compressor in Audacity. Here is the help page for it.
Audacity is an audio editing program and it is great value for the price (£0).
How, you might use it depends on how you listen to music. If you use an iPod or some other device to play digital files then it might be as simple as opening the file in Audacity, running the Compressor tool, and saving it again. If you use CDs then you might need to rip the CD, process the file in Audacity, save it, and burn it back to a CD.
I have used Audacity but not yet this tool. Generally, I would avoid compression (in this sense) like the plague and I would certainly never use it at home but that's just my preferences: I prefer to either to music properly or not at all; not background music while I do something else. However, I have been tempted to create compressed versions for the car. I drive a convertible and even with the roof up, the noise level is quite high: either the quiet bits are drowned or the loud bits are deafening. (Okay, sometimes I listen to music while doing something else.)