According to Peter Theil in his book Zero to One, there are four ways that businesses can create long-term competitive advantages. Here's my view on how to take advantage of them.
AKA proprietary technology. If you can solve a hard problem better than anyone else, you can turn it into an advantage. Obviously, this isn't easy and will require a lot of hard work. The way to maximise your advantage is to master a small circle of expertise that is highly difficult, economically important, and under-served. The amazing thing is that nobody or no lack of resources can really stop you from achieving this. It comes down to your ability to develop a useful set of knowledge and skills.
AKA branding. Companies with great reputations sustain prices waaay higher than normal (just ask Apple or Nike). Products from these companies have lower perceived risk, increased perceived quality, and enhance customers' social status and sense of self-esteem. Amazingly, no one can really stop you from achieving this either. Reputation is just a lagging indicator of culture and quality of output.
AKA economies of scale. Doing something many times results in lower costs. The cost of R&D is divided between more purchases, production gets incrementally more efficient, and resource costs per unit decrease as orders get bigger. As the saying goes, learn by iteration, earn by replication.
AKA network effects. When people have spent time and energy learning to do something one way, they resist having to change. For example, it's hard to change social networks if all your friends aren't switching, most of us stick to Google for our preferred search engine and buy online at the same websites again and again. Theres a powerful momentum in human behaviour that gets multiplied if it involves more people.
If we add them all together, the way to build a company with long-term competitive advantages is to master a specific discipline that is highly difficult, economically important and under-hyped. Then use this superior expertise to delight your customers and build a strong reputation. Once you've iterated and perfected your products or services, lower your costs by replicating them ever more efficiently across a particular type of customer. Eventually, you will establish worn-in behaviours that will help retain your existing customers and encourage new ones.