Cochrane was elected Member of Parliament for Ipswich in July 1839. He went on to be second-in-command of the East Indies and China Station in July 1841 during the First Opium War and, having been promoted to rear admiral on 23 November 1841, he became Commander-in-chief of that station, with his flag in the third-rate HMS "Agincourt" in 1844. He took part in anti-piracy operations around north-west Borneo including the destruction of the forts at Brunei in July 1846. He was promoted to vice admiral on 14 January 1850 and became Commander-in-Chief, Portsmouth in 1852. Promoted to full admiral on 31 January 1856, he was appointed Vice-Admiral of the United Kingdom on 16 May 1863 and then promoted to Admiral of the Fleet on 12 September 1865.