Written and first recorded (as “(You Got to Have) Friends”) by Buzzy Linhart (1970).
Hit version by Better Midler (US #40/MOR #9 1973).
From the wiki: “‘Friends’ (also titled ‘(You Got to Have) Friends’) was written by Buzzy Linhart and Mark ‘Moogy’ Klingman and was first recorded by Linhart in 1970. Bette Midler was one of Linhart’s close friends during the early 1970s. While rehearsing for an audition for a Broadway show called Mirror Cracked, Linhart sang ‘Friends’ to Midler.
“After hearing the song, Midler asked Linhart if she could sing the song during a show that she was performing at the Continental Baths in New York. Soon after, Midler recorded the song (twice!) on her debut album The Divine Miss M, and released the song as a single backed with ‘Chapel of Love‘.