I tried reducing the number of lines with this method, but the result was that the surface became jagged. I want the surface to remain smooth.
I did another experiment, but the results were still not optimal. 2nd experiment :
You can use this kind of topology, where the mesh goes around the corners:
I suggest you don't matter of the circular part at the begining, as you can always make it circular at the end using loop tools.
Basically, that means you've a quad at each corner of the mesh, and either open it in order to turn around it (in green) or prolongate it to have the 'bevel like' edges (in blue).
Here the result in the blend file (but I've not really worked on the parts that are not shown in the above image).