The following example features two guitar parts. Listen to how one leaves space for the other and how they connect at certain points to keep the sound tight.
When you have two guitarists in a band, it is important to work out clearly defined parts so that they complement each other, rather than clashing. Careful listening, discipline and lots of rehearsal is the key. Listen to bands like ACDC, Lynyrd Skynyrd, and Metallica to hear great examples of two guitarists working together.
Here is an example which features guitar and keyboards. When working with a keyboard player, the same principles apply as when working with another guitarist. In this example, the keyboard locks in with the drums and the guitar plays a complementary rhythm and then leaves space for the keyboard to be heard, before doubling the keyboard part just before it repeats.