In QGIS Plugins you'll find a 'merge lines' plugin, which at first sight seems to accomplish what you are after.
cited from description:
MergeLines
Simplifies the topology of a line network by merging adjacent lines
This plugin merges segments of a line network (e.g. river network) in order to simplify its topology. Two merging methods are currently available : length (a segment is merged with its longest neighbor) and alignment (a segment is merged with its best aligned neighbor).