Polyaniline (PANI) chains were grafted at the edge of graphene oxide (GO) sheets by in-situ chemical oxidation polymerization. The obtained GO-PANI composite was used for the adsorption of cationic methylene blue (MB) and anionic methyl orange (MO) dyes from aqueous solutions. The structure of the GO-PANI composite was characterized by Fourier transform infrared spectroscopy (FT-IR), X-ray diffraction (XRD), scanning electronic micrograph (SEM), X-ray photoelectron spectroscopy (XPS) and zeta potentials. GO-PANI exhibited a high adsorption capacity for MB (962 mg/g) and MO (885 mg/g) compared with other reported absorbents, which was due to adsorption through strong π-π stacking and anion–cation interactions. The nanocomposite could be recycled five times without significant loss in removal abilities for MB (87.8%) and MO (75.0%), respectively. GO-PANI composite is a promising adsorbent for the adsorption of anionic and cationic dyes from aqueous solutions.