Usually it is me killing the companions, not the game. I learned that battles in 3rd person are better for companion survival.
I also make a save before I enter any dungeon and before entering a new cell in a dungeon after I make sure my companion is behind me.