I'm travelling somewhere with a friend, but would like to return on a separate date than my friend. For that reason I suppose I need to buy the tickets together. Is there another way to do that?
You can, from a travel agent or by phone to the airline (or at a ticket desk). However, the "PNRs" [passenger name record---the database record of your journey] will be split anyway so you and your friend will be on separate bookings. It is not possible for a single PNR to contain different flights for different people.
The PNRs can be "linked" together so that theoretically if one of you is moved out of your seat the airline know that you are travelling together, but to be honest it doesn't really achieve much and is not a reliable system. You can also ask to link your PNRs after you buy them separately.
Frankly I would not bother, just buy your tickets separately and then arrange to sit together when you choose your seats.
In the process of flying, there are different steps. The first is the booking, but there are others, mostly checking in and boarding.
If you want to fly with your friend, when booking a flight, you should make sure you book the same flight (i.e. same day, same time, and usually same flight number). At least you will go to the airport at the same time and will fly on the same plane.
For most airlines (all the flights I ever flew), the choice of seats is relatively independent from the booking. There are multiple times it can be possible to pick a seat (at booking actually, between booking and check-in, and at boarding), but the most common is at check-in. At that time, a large share of seats are available. So if your only goal is to sit together, be the first to check in. It could be an online check-in, 24 hours in advance or sometimes earlier, or at the airport (if online check-in is not available).
On a close topic, there are now services that offer to friends who want to fly together (but on the same entire itinerary apparently, so this is not for you) to book together but split payment properly. There is a question on that topic.