I usually just use ctrl+k, ctrl+d shortcut in Visual Studio and let it format my code for me.
You can customize the way Visual Studio formats the code by going to Tools -> Options -> Text Editor -> HTML -> Format
However, when there are a lot of attributes in an element I usually organize the elements like this:
<cc1:MediaGallery ID="MediaGalleryControl" runat="server"
AllowUpload="false"
AllowUploadPreview="false"
MediaLibraryName="Downloads"
DisplayActiveContent="true"
DisplayFileCount="true"
TransformationName="Community.Transformations.MediaLibrary"
FooterTransformation="Community.Transformations.MediaLibraryFooter"
HeaderTransformation="Community.Transformations.MediaLibraryHeader"
HideFolderTree="true"
FileIDQueryStringKey="fileid"
/>