Yes. There is no “use it or lose it.” The balance rolls over every year and stays yours, even if you no longer have an HDHP.
That is a key difference from most FSAs, which generally require you to spend the money within the plan year.
Because the money keeps rolling over, many people use their HSA as long-term savings for future medical costs, including costs in retirement.