On the whole, viruses are actually good for their hosts.
Editorial by Ben
It is a common misconception that most biological viruses are bad for their hosts. The driving reason for this misunderstanding is that the viruses we care about are bad, Influenza, HIV, etc. These viruses hurt us and we hurt them.
The answer is no. What we are calling a virus would be more accurately called a message. Just like messages on the internet, a small minority are pathogenic viruses aimed to hurt their hosts. But the vast majority are welcome messages. If they were not, then a cell, just like a computer, would simply stop listening to external messages.
If the cell is listening to these messages even though some of them are fatal, they must confer some evolutionary advantage. The total advantage of the useful messages must outweigh the detriment of the pathogenic ones. What sort of advantages are these?
In essence viruses play the role of a letter in a critical message exchange system. We don't know everything that RNA and DNA do, but we do know that viruses help to spread useful bits of code between cells. This includes useful proteins, regulatory sequences, and sequences that we do not yet understand the value of.