Southwest is within its rights to offload you -- and fill your seat with a standby passenger -- if you are not at the gate and ready to board at least ten minutes prior to scheduled departure. Whether you are entitled to overnight lodging might depend on whether the mis-connection resulted from factors within Southwest's control. You'd have to check the terms of the contract of carriage.
You can minimize the risk of this recurring by:
1. not booking a connection to the last flight of the day to your final destination; and
2. not booking travel with relatively short connecting times.