You don't have to worry about joining 2x4s so they will be strong. I made the simplest possible bike rack by butting them together and nailing them. It's not at all sophisticated but it is easy to build and strong enough to do the job.
Sorry, I had to omit my image because, "You need at least 10 reputation to post images."
I happened to have some scrap lumber, consisting of two 6-foot boards and many 30-inch pieces. The two 6-foot boards are the top and bottom of the bike rack. The bottom of the bike rack sits on the ground. The 30-inch pieces are nailed vertically between the top and the bottom boards, forming slots into which your bike tires sit. I spaced the vertical pieces according to the varying widths of various bikes' tires.
The bike rack can stand alone, but it becomes much more stable when at least one bike is inserted into each side of the rack. The vertical boards keep the bikes from falling over. There's enough friction that, on the floor of my garage, the bikes don't roll away on their own.
Here is a picture of the rack when it is fully-populated:
Sorry, I had to delete my second image because, "You need at least 10 reputation to post images."