You are right that leaving the boots to air out periodically is the best solution, but not always doable.
Changing sweaty socks is a good way to get boots to smell less. Socks are easier to carry multiple pairs of, and to clean and dry out. Since socks are the first layer in contact with sweaty feet, clean socks usually imply less-smelly boots.
On longer trips in bad winter conditions, however, most measures are insufficient, and one gets used to it (not by choice, but by compulsion). But taking these measures is still a whole lot better than doing nothing at all. Using a small amount some form of anti-fungal powder on the feet is a good step too.
Post-trip: most good hiking boots are fine with water and can be cleaned with a small amount of very gentle detergent (it is important to use a gentle detergent, so that the leather doesn't get ruined, and more importantly so that the glue doesn't come off).
I first wash all the dirt/mud/etc. off the boots, and then leave them dunked in a bucket of water (with a small amount of gentle detergent) for a couple hours or so, rinse thoroughly repeatedly and leave it to dry out in the shade for a couple days, and leave it to air out for a few more days, and then store it back with something lodged inside to preserve the shape.
Also bear in mind that leaving boots idle in storage for long durations is not the best (especially for the PU in the midsole, which can start to rot). It is best to wear them from time to time, even when not actually hiking.