If you don't finish the keg before the beer goes bad, you can try to use a beer saver system to preserve the beer.