The reason bread sinks after baking is because it wasn't quite fully cooked. The best way to ensure it is cooked is to use a thermometer to ensure the base of the loaf reaches 200 degrees Fahrenheit. I use this thermometer and it works great and is very affordable. (affiliate link)