The 74-year-old, who has been in London since mid-January, said that although he felt better, he still required rest and further treatment in the coming weeks.
Vice-President Yemi Osinbajo would remain in charge at least over the weekend, he added.
Buhari, who looked gaunt in a billowing black kaftan, did not specify when he would resume his duties but his spokesman, Femi Adesina, said his return would be formalised on Monday.
Buhari's unspecified illness has been an increasing source of speculation in Nigeria ever since he left for London on January 19 for medical tests during a period of annual leave.
More From This Section
Aides had to counter persistent rumours online that he was seriously ill or even dead, despite a series of photographs showing him meeting senior Nigerian politicians.
On Thursday he was shown in photographs looking painfully thin at a meeting with the most senior cleric in the Anglican congregation, Archbishop of Canterbury Justin Welby.
But Buhari appeared to contradict that in a rambling address to ministers and senior members of his ruling All Progressives Congress party that touched on the importance of education and technological advances, and appeared to warn against the dangers of self-medicating.
He made no mention of what illness he was suffering from but said had thought he had received "the best of treatment I could receive".
"I couldn't recall being so sick since I was a young man," he added, referring to "blood transfusions, going to the laboratories and so on and so forth".
Buhari's return from London was announced on Thursday evening and he said he "came back towards the weekend, so that the vice president will continue and I will continue to rest".
The presidency maintained the comment was light-hearted but was quickly followed by his spokesman's tweet clarifying the constitutional position.