Hold several 2x4s together for tabletop?
Really the only reliable way to hold boards together to make a top is to use some type of perpendicular board to attach them to like in this traditional picnic table:



This type of top will normally have small gaps between the boards to make them appear more uniform.  A small gap ends up looking better than a very uneven butt joint, but that can depend on the exact boards you choose.

If you had some high quality lumber, you could square up the edges on a jointer and glue and biscuit the boards together, but rough 2x4s are not straight enough for that, and they are likely to shrink/expand/twist over the years which would crack that type of joint in the long run.