What are the rules for close/formation flying of civilian planes?
Pilots are allowed to fly as close as they want to each other as long as all parties agree to it and feel safe doing so.

Air Traffic Control cannot guarantee separation for planes in formation flight,So this will only be done under VFR and in VMC, where pilots can maintain visual separation from each other.

Many stunt fliers are civilian pilots and will routinely fly in close formation as well.

Other notable example of civilian formation flight include Mythbusters testing airplane fuel efficiency in formation and Airbus' publicity stunt with 5 A350s