The 37-year-old Pakistan batsman will continue to be available for selection for Test matches.
“I will retire from ODI cricket after 2015 World Cup. Will continue to play Test cricket,” he said on Twitter.
Khan has scored almost 16,000 runs across all formats of the game for Pakistan during his 15-year international career.
Pakistan were beaten by fierce rivals India in their World Cup opener before slumping to a 150-run defeat to West Indies last Saturday.
Their next Pool B fixture is against Zimbabwe at the Gabba in Brisbane on Sunday.