Most insurers will only count no claims bonus (NCB) within the last 2 years but there are no set standards regarding this at the moment.
This means that if you don't drive for a period not exceeding two years and then decide to become a policyholder again, you will be able to use that no claims discount (NCD) you accumulated before but if the elapsed time between you getting your own policy and last held one is greater than 2 years, then you will start back to square one, that is, zero no claims bonus.
You should note that whilst many insurers will consider your NCD expired if not used on a policy within 2 years, some however may have different timescale for expiration of the said no claims. This is why it is important to contact your current insurer to discuss this as they will be the one to provide you with a statement of NCB held with them on renewal.
It is said that no claims discount expires if you don't use it but since you will be going as a named driver, you will be using your 5 year no claims on your boyfriend's policy. Although you most certainly would not accumulate any more no claims discount, it might be possible that your current no claims is kept 'alive' because you're still driving as a named driver. This depends from insurer to insurer and like I've said before, your best call of action is to get in touch with your current car insurance company to find out these details.