Scenario one - you've just bought a new home, the old owners are moving out before the closing date, and you want to start moving in early - proceed with caution! Scenario two, you've just sold your home, but can not move out until after the closing date, so you're going to rent it back from the new owners - be equally as cautious!
A purchase contract usually dictates that 'occupancy' (the day the old owners must be out, and the new owners may move in) is to be given at the time of settlement, on the day when the money and the house-keys change hands. While it may sometimes be necessary for you to move in early or stay on longer, most real estate agents, and lawyers alike, would strongly advise against doing so!
Too many things can go wrong. When moving in early, buyers have plenty of time to discover every little problem that may be wrong with the property. Or maybe they don't ever obtain their financing. What then? Costly legal bills, that's what. And who will pay for the window that breaks in the meantime? Whose insurance covers the house and their belongings? And a rare case, but a possible one - what if they never do close on the house and then take their time moving out? Would normal eviction regulations apply?
Now let's look at the other side too. There are on occasion times when the seller may need to close, but can not immediately move out. Often in these situations a clause would need to be added to the sales contract, and the seller would rent back the property from the new owner. Again, many of the same issues, as noted above, would apply.
Keeping all these potentially disastrous situations in mind, when planning to move in ahead of time, or stay on when you no longer own the house, your best bet would be to get a good attorney and a good contract. And read the 'fine print', BEFORE you sign it!