⭐ Best answer
Start with what your lease and local law actually require — most places set a minimum notice window (commonly 24-48 hours) except for genuine emergencies, and that's not a suggestion, it's usually the law. A few steps, in order:
1. Put it in writing. A text or email saying "please give me the notice required by my lease before entering" creates a record and often stops it on its own — a lot of landlords who do this aren't trying to be bad actors, they just haven't been told no.
2. Keep a log. Dates, times, what happened. You probably won't need it, but if this keeps up, you will want it.
3. Check your local tenant rights office or a tenants' union before you escalate — notice requirements and remedies vary a lot by state and city, and they can tell you exactly what leverage you actually have.
4. If it continues after a clear written request, that's when it's worth a formal letter citing the specific law, often with a copy to the landlord's property manager if there is one.
Most of this resolves at step 1. Landlords who keep doing it after a clear written request are a different problem, and that's when you stop being polite about it.