Each of the seven children's chronicles is based on one of the seven planets that comprised the heavens in medieval astrology, says a scholar whose theory is examined in the programme.
The explanation comes after more than five decades of literary and theological debate over whether Lewis devised the fantasies with a pattern in mind or created characters and events at random.
It is put forward by Reverend Dr Michael Ward, in his book Planet Narnia: The Seven Heavens in the Imagination of CS Lewis.
Norman Stone, director and producer of The Narnia Code, to be screened on BBC2 at Easter, says the theory is the "best explanation yet" for the chimerical nature of the books.
The Chronicles of Narnia have sold over 120m copies in 41 languages since their first publication in the early 1950s first of the books, The Lion, The Witch and the Wardrobe, was turned into a film starring Tilda Swinton and James McAvoy in 2005.
The books are already known to work on two levels: the fantasy narrative enjoyed by generations of children, and the Christian allegory in which the lion Aslan represents Christ. However, Lewis never revealed the hidden key behind the series.
Dr Ward made his discovery in 2003 after reading The Planets, a poem by Lewis which refers to the influence of Jupiter in "winter passed / And guilt forgiv'n" – a theme echoed in The Lion, The Witch and The Wardrobe.
He claims Lewis' knowledge of medieval history, of which he was one of the leading scholars, made him familiar with the characteristics attributed to the seven planets during the period. Each of these planets gives one of the books its theme. Prince Caspian, for example, is a story ruled by Mars, who is manifested by soldiery and battle, while The Voyage of the Dawn Treader focuses on the Sun, with its light and gold themes. In The Horse and His Boy, based on Mercury, the planet that rules the star sign Gemini and is associated with the power of communication, the characters include twins and a talking horse.
Mr Stone said: "This isn't the first theory on Narnia and I don't suppose it will be the last but this is the best explanation yet.
"Critics of Lewis said his writing was sloppy - Tolkein, for example, said the characters were a mish-mash - but this third level of meaning shows the books were not simplistic. In fact, writing such a complex set of notions into a novel must have been like three-dimensional chess.
"Lewis was a great medievalist - a real expert on the period. He was also interested in astrology. He loved the medieval view of the world. His view of faith was also that if it is to be anything it must be cosmic."
He added: "This will help change the view of Lewis. It will help elevate Lewis to a different level and make him the equal of Tolkien - both as a writer and thinker. He felt that we have been blinded by facts, but he loved hiding things. He loved the idea that people learnt more by discovering things themselves, especially hidden things. A lot of the meaning of God is after all hidden."
Mr Stone, who is married to television presenter Sally Magnusson, won both a BAFTA and an Emmy for his 1984 epic Shadowlands, which traced the unusual relationship between Lewis and his wife Joy Gresham.
Sunday Telegraph (London) – 30 November 2008