You have more good options than just buying endless bottles. Bottled water is the easy default; stick to sealed bottles from proper shops, check the cap seal since refilling scams exist in some places, and note that large multi-liter containers delivered to homes are the standard economical choice for residents in bottled-water countries.
For longer stays, filtration wins. Countertop or under-sink multi-stage filters, common in expat households, make tap water drinkable at a fraction of bottle cost, and many rentals in such countries come with a unit already installed; just confirm the cartridges have actually been changed. Portable options serve travelers well: quality filter bottles handle bacteria and protozoa, purification tablets or drops are a lightweight backup, and UV purifier pens work on clear water.
Boiling remains the universal fallback, a rolling boil for a minute or so, longer at altitude, then cooled; it kills the biological threats, though it won't remove chemical contamination.