The 24-year-old du Preez joined the Pro12 club after leaving Southern Kings in 2013, while Cochrane, 32, arrived from London Wasps the following year.
Du Preez is enjoying working under compatriot and coach Alan Solomons.
"The squad karma is really good and the club is moving forward," said du Preez in a club statement.
"I enjoy working with Alan and it's good that he's staying on. I know what he expects from me."
Du Preez had previously worked under Solomons at his former club, but he suffered a serious lower leg injury last season.
"It was difficult coming back from injury, but our club physios did a great job to fix me up and all's good now," he said.
"I'm looking forward to helping the club stay in the top group of the Guinness Pro12 and challenging for a place in the Champions Cup next season."
Cochrane, who had spells with Rotherham Titans, Doncaster Knights and Bedford Blues, also praised Solomons' work and relished the challenge of winning a place in the team.
"We have some talented young hookers coming through the club, which is great and keeps me on my toes," said the Edinburgh-born forward, who made a mid-career switch from the back row.
Solomons was delighted to retain both players.
"Cornell is a class player who has proved invaluable for us," he said.  "He is also a great bloke and a good team man.
"Neil has made a terrific contribution to the team since returning home from Wasps.
"He is a superb hooker and a very good leader."
South African number eight Cornell du Preez and Scottish hooker Neil Cochrane have signed two-year contract extensions with Edinburgh.