Selling primary residence after moving to a new state

I have lived in the property as primary residence for 1.5 years before moving to another state due to job change. I have been renting the property out in the past two years. Can I still claim the free capital gain credit if I sell the property now? Can I rent it out for another year before selling and get to the capital gain credit?  (The estimated gain is under $150K.)

 

Thanks very much.