As far as I'm aware, Sinclair held the rank of Lt. Commander when he gained the post of commander of Babylon 5. Sheridan held the rank of Captain when he was the captain of the Agamemnon and later when he was appointed to the post of commander of Babylon 5.
Popping in late on this one, but the fact that Sheridan was addressed as 'Captain' while he was in command of the
Agammemnon is not an indication of his rank; by long-standing tradition, the person in command of a warship is always addressed as 'Captain' aboard ship, regardless of his actual rank (related to this, any military officer with the actual
rank of Captain is addressed as one rank higher -- Commodore/Admiral for Navy, Major for Army/Air Force -- because there can only be one captain aboard a ship).