You should demand that your rental agreement stipulates that your landlord must give at least 24 hours notice before entering your home. This is pretty standard, but in cases where it's not yet in the contract make sure to have it added.
> and they can sell or occupy it, requiring you to move
Depends where you live. In California (at least in SF and LA; don't know about elsewhere), landlords can only do this if they or a family member will be moving in. In SF in particular tenant rights are strong and it's practically impossible to evict tenants.
Though in my opinion they go too far there; non-paying tenants can linger for months, and creepy d-bags who sexually harass other tenants can't be kicked out even if the landlord and everyone in the building wants them gone (true story).