Tā yǐwéi zìjǐ kàndào le guǐ, qíshí zhǐshì huànjué.
He thought he saw a ghost, but it was just a hallucination.
Tips
usage
幻觉 can be visual, auditory, or any sensory illusion. In casual speech, 产生幻觉 (to have hallucinations) and 出现幻觉 (hallucinations appear) are common collocations.