As long as the company remains in business, you keep your domain name.
However, if the company goes out of business, your domain name goes with it.
There are two ways to buy a domain for life.
The first way is to buy only the domain.
How long can you own a domain name?
You can buy domain names in year-long increments, up to a maximum of 10 years. You might be able to save some cash by picking a slightly different domain name.
Is it possible to own a domain name?
Anyone can buy a domain name. To do so, you visit a domain name registrar, such as GoDaddy or Namecheap, key in the domain you want to buy, and pay a fee. You can’t buy just any domain, of course—only one that isn’t already registered by another person or business and that bears a valid domain suffix.
Who owns unused domain names?
The .com TLD is owned by Verisign, who charges $6.42/year for a domain. Then you also have to pay another $0.20/year to ICANN, who controls the whole domain name system for the public internet. The registrar can charge you whatever they want. As long as Verisign and ICANN get their money, the domain name is yours.