Can we avoid Capital Gains tax when we sold a two primary residences in same year?

In 2024, my wife and I sold a primary residence we lived in for 4 years for an approximate gain of $115k -- she was the only owner. Also in 2024, we sold a rental property, that we previously lived in as a primary residence for over 24 (non-consecutive) months, for an approximate gain of ~$125k-175k -- we were joint-owners. Is there a way to sell both of these properties as "primary residences" to avoid capital gains? Would we have to file separately? Any advice is much appreciated