Here are some suggestions I use to keep a boss fight interesting:
1.) Use bosses with legendary/lair actions. If they don't have them, just add them.
2.) Position the boss battle in a changing terrain. If you have a Giant Ape attacking the city and the PCs are fighting it, consider the impacts the destruction of the city might have on the PCs and how they might fight.
3.) Give secondary objectives to the PCs. If a Giant Ape is attacking, there are innocent people in danger. If the PCs help, great. If not, are they blamed for the deaths? How will that impact the situation in the future?
4.) Don't. Let them be easier. Not every battle needs to be a drag out fight to the death. When PCs win big, it makes them feel like heroes. Just make sure that every combat has a purpose, even if it isn't to challenge the PCs. A Giant Ape attacking town could be an easy win for the PCs - but why was a Giant Ape attacking town?