Why Lankavatara Sutra was replaced with Diamond Sutra by 5th patriarch? As far as I know, Lankavatara Sutra was held in high esteem by both Bodhidharma &amp; his disciple Huiko to the extent both based their way of enlightenment on this Sutra. But what it is seen that 5th patriarch Hunjeng recommended his disciple Diamond Sutra. From there onwards, Diamond Sutra took the central position in Zen.

What was the reason for this gradual replacement of Lankavatara with Diamond Sutra?
Many of the early Chinese patriarchs and their works are partially or completely shrowded in mystery. For example, it was probably not Hui-Neng, but his disciple Fahai who recorded the teachings and dialogues of his master. The work most closesly associated with the 5th patriarch is the East_Mountain_Teaching, the first "really Chinese" collection of teachings not based on translations of Sanskrit texts. 

The Diamond Sutra you are referring to is just a section of the works of Hongren and Hui-Neng, the latter is called the Platform Sutra, referring to the platform on which the master would sit during his discourses. The Platform Sutra actually contains discourses on the Diamond and the Lankavatara Sutra, as well as many other Sutras. So does the East Mountain Teaching collection of the 4th and 5th Patriarch.

It's indeed true the popularity of the Lankavatara Sutra declined, but this evolution started long before Hongren and Hui-Neng. Early masters of the Chan tradition were referred to as "Laṅkāvatāra masters", as this is one of the texts that Bodhidharma supposedly brought with him from India. This sutra was probably written around 350 CE, but in China this is not the most copied edition. Two subsequent editions with many commentaries and additions were made between 500 CE and 700 in collective volumes called the Taisho Tripitaka. Scholars nowadays think that the Lavankatara Sutra declined in popularity because of certain chapters that were based on Theravada values, such as eating meat and the "Thrice Clean" practice. 

The first Chinese translation of the Diamond Sutra dates to the early 5th Century, but the version that supposedly caused Hui-Neng's enlightenment experience was brought to China in the 7th century by a monk called Xuanzang. Also consider that the printing press in China was invented in the first half of the 9th century. The oldest surviving printed text we actually have is a version of the Diamond Sutra from Dunhuang. This would certainly have been a major factor in its distribution and therefore its popularity.

So, in conlusion, the popularity of the Lavankatara Sutra in China was set in motion long before Hongren and Hui-Neng. The subsequent (heavily edited and commented) editions of this sutra were both created by imperial edict, which would have had considerably more influence on Chinese Buddhhism as a whole in stead of just the Chan school.