You will need to extend your visa or get another.
One thing you did not mention is the way you obtain your Indefinite Leave to remain (ILR). If you came to the country on a work permit or changed your visa from any other category then you need 5 years total stay in which you must have ILR for last 12 months
If you have ILR for at least 1 year then you can apply for your citizenship unless you are married to a british citizen . So if you don't have ILR, you need to get it before you can apply. You do need to complete your 5 years, cannot apply before. That's the rule but there are always exception. 90% of the time Home Office apply the rule