Although Walnut oil (WO) has been reported to enhance cognitive function, the underlying molecular mechanisms are not well understood. This study was designed to assess the effects of WO on spatial memory in rats through modulation of the expression of acid‐sensing ion channel genes, Asic2a and Asic4 . To investigate the effect of WO on cognitive performance, we supplemented the diet of female rats with WO. The results showed that supplementation with WO at doses of 2.2 and 11 g kg−1 day−1 significantly improved learning and memory. In vitro treatment of rat hippocampal neuronal cells with appropriate doses of WO revealed a significant increase in the expression of Asic2a and Asic 4 in a dose‐dependent manner at both the mRNA and protein levels. We conclude that WO intake might help to prevent cognitive decline, particularly in the elderly, and that ASIC genes in neurons can be the targets of compounds contained in the oil.