If B is 3 chairs to the right of A, A can only be seated in chair 1,2, or 3. Otherwise, B is to the left of A, and the possible positions of A and B are switched. That gives 6 possible ways to seat A and B:

A---B--

-A---B-

--A---B

B---A--

-B---A-

--B---A

For each of these ways there are 5! = 120 ways to seat the remaining 5 boys. That gives 6*(5!) = 6! = 720 possible ways to seat the 7 boys under the restrictions listed.