1. The exclusion rule is you have to live in the house 2 years out of 5 years before the sale.
2. Exception for exclusion rule is: you qualify for partial exclusion if you moved out because (1) change of employment more than 50 miles away; (2) health reasons (3) other unforeseen circumstances (death in family, divorce etc).
In your case, you only lived in the house for 9 months. Assuming you qualify the exemption under (1), you don't qualify for full 500K exclusion, you qualify for 9 months / 24 months x 500K = $187.5K being excluded from your taxable capital gain. (This is an estimate, actual math is based on days not months).
3. When should you sell your home to enjoy the partial exclusion.
This part I am not too sure about when you should sell your house.
The law says any portion of the 5 years AFTER the last date as principal residence is not counted as nonqualified use. (see end of this post)
It is clear that if you lived 2 years and rented (5-2) = 3 years it qualifies as full exclusion of $500K (see IRC below). But since you lived 9 months, and have the exemption to 2 years out of 5 years rule, do you now enjoy (60 - 9 months) = 51 months of rental period without losing the exclusion?
I would consult an accountant on this issue. From the plain meaning of the law it seems to mean you have 51 months.
Internal Revenue code provides that:
https://www.law.cornell.edu/uscode/text/26/121
(C)Period of nonqualified use(ii)Exceptions The term “period of nonqualified use” does not include—