Basically, the rule that you want to follow is just as long as he has no effect on your career.
Here is the excerpt from AR 600-20 (Army Command Policy):
Relationships between soldiers of different rank are prohibited if they:
(1) Compromise, or appear to compromise, the integrity of supervisory authority or the chain of command.
(2) Cause actual or perceived partiality or unfairness.
(3) Involve, or appear to involve, the improper use of rank or position for personal gain.
(4) Are, or are perceived to be, exploitative or coercive in nature.
(5) Create an actual or clearly predictable adverse impact on discipline, authority, morale, or the ability of the command to accomplish its mission.