Your lease continues to run.
Check with a lawyer (or your local city or county) for more information.
Your landlord might make you an offer to move out--pay you a thousand dollars or so and perhaps moving expenses. If so, you can accept or reject that.
Recognize, too, that if the house has just been listed, it's likely to be 3-4 months before the new folks could move in. For instance, let's say the property's listed. And let's say it gets a contract in 30 days. (That's pretty good in many markets.) And let's say the whole buying process takes another 45 days. That's 2-1/2 months if everything goes very smoothly. If it's on the market for 60 days, and it takes 60 days to close, you're up to 4 months. So, as a practical matter, you may not have a problem.
However, from a technical standpoint, it's your landlord--not you--who has the problem. If you've got a valid lease and you haven't broken it, you get to stay.
Hope that helps.