5,5'-(1,3,5,7-Tetraoxopyrrolo[3,4-f]isoindole-2,6-diyl)diisophthalic acid (PMDIG) is used to produce a supramolecular hydrogel via acid-base treatment. The field emission scanning electron micrograph and atomic force microscopy micrographs exhibit a fibrillar network structure from intermolecular supramolecular interaction, supported from Fourier transform infrared (FTIR) and UV-vis spectra. The fluorescence intensity of the PMDIG gel is 16 times higher than that of the sodium salt of PMDIG with a 42 nm red shift of the emission peak. Upon addition of an anilinium chloride solution to the PMDIG gel, it transforms into the sol, and when a solid ammonium persulfate is spread over it, a stable hydrogel is produced. The co-assembled PMDIG-polyaniline (PANI) gel exhibits a fibrillar network morphology, and the co-assembly is formed by the supramolecular interaction between the polyaniline (donor) and the PMDIG (acceptor) molecules, which is evident from FTIR spectra and wide angle X-ray scattering results. The UV-vis spectrum of the PMDIG-PANI hydrogel exhibits the characteristic peaks of polaron band transitions of the doped PANI. The PMDIG-PANI co-assembled hydrogel has a 51-fold higher storage modulus, a 52-fold higher elasticity, a 1.4-fold increase in stiffness, and a 5-fold increase of fragility compared to the values of the PMDIG hydrogel. The PMDIG-PANI xerogel exhibits a 4 order of magnitude increase in dc conductivity compared to that of PMDIG, and the I-V characteristic curve exhibits a rectification property under white light illumination showing photocurrent rectification, a new phenomenon reported here for the supramolecular gel systems. A dye-sensitized solar cell fabricated with an ITO/PMDIG-PANI/graphite device shows a power conversion efficiency (η) of 0.1%. A discussion of the mechanism of gel formation and the sol state of the PMDIG-aniline system is included considering the contact angle values of the xerogels.