In general, there are two roles a guitarist can play. There's the "lead" roll, and there's the "rhythm" roll.
With the lead role, you play leads, riffs, solos, contributing to the melodic aspects of the music. With the rhythm role, you play riffs and chords contributing to the rhythmic and harmonic aspects of the music. In essence, you make the bed that the lead guitarist, singer, etc., jump on. I think a canonical example is AC/DC, where Angus Young played the leads while his brother Malcolm banged out the rhythm. It is hard to be wholly a lead guitarist in a vocal-lead band, because your lead playing could get in the way of the singer.
There are guitarists that combine these. Eddie Van Halen is always playing the song, always playing notes and riffs. You could hear just his guitar track and know he song. He has the freedom to do this because he's the only guitarist, leaving the whole space open for him to play with. Keith Richards of the Rolling Stones and Johnny Marr of the Smiths (and others) also have styles where their parts are equal parts rhythm and lead playing.
There are very few bands where there are three guitarists. Classic Motown studio tracks had many guitarists, but each had their pocket and went for a small amount of harmonic space, as was explained in Standing in the Shadows of Motown. In a drastically different style, Iron Maiden currently has three guitarists, because Adrian Smith left, was replaced by Janick Gers, and then returned. There's Gers-led material that became part of their show, so they got together and developed three-guitar arrangements.
This is the key. Each guitarist has to have a role, a harmonic and rhythmic part in the music to take. This takes planning, time and experience.
I came into practice last night as one of three electric guitarists, supplemented by two acoustic guitarists. Acoustic guitar in a rock band becomes more-or-less a tuned snare drum, really setting the rhythm of the piece. Lead guitarist has a lot of fairly clean Strat work, singer/guitarist is hitting the rhythm/grit aspects, and for the life of me, I don't know where my Tele fits in to all this, which means, when I try to fill spaces, I step on other people's toes. This, on top of the gremlins of the venue, make me profoundly ambivalent about playing this music.