In a televised speech, Mr Buhari, 74, said he was “distressed” by calls for the dissolution of Nigeria, urging Nigerians to come together.
But the president failed to disclose his illness. It was his second spell of medical leave this year.
Many Nigerians had called for him to resign during his absence, saying he was unfit to run the country.
Others have called for more transparency over his condition, as speculation grows over whether he will be fit to seek a second term in 2019.
Image copyrightAFP/GETTY IMAGES
Image captionNigerians urged their president to return to the country – or resign
Vice-President’s Yemi Osinbajo has been in charge during his leave but Mr Buhari has now officially resumed his duties as president.
Speaking two days after his return, Mr Buhari said that comments around the dissolution of Nigeria had “crossed national red lines”.
“Nigeria’s unity is settled and not negotiable,” he said. “We shall not allow irresponsible elements to start trouble.”
The president also made reference to ethnic violence in the country, blaming “political mischief-makers”.
Ethnic tensions – with some calling for a separate state in the south-east known as Biafra – surfaced during his leave, while the war against the Islamist militant group Boko Haram continued in parts of the north.
Calls for Biafran independence 50 years on
Stephanie Hegarty, BBC News, Lagos
Nigerians were hoping to find out just what’s wrong with the president – to get some clarity on the mystery illness that had him absent from his job.
But it seems the presidency intends to keep Mr Buhari’s condition a secret.
They may have trouble convincing the public to believe the line they’ve been touting for months that the president is “hale and hearty”. He was visibly thin and frail as he greeted politicians on Saturday.
He has made some sort of recovery – in his last public appearance before he left in May, when he greeted the 82 released Chibok girls, he was barely able to stand.
On Monday, the president was eager to show that he is ready to take the reins again.
But the address will fail to answer the question on many people’s minds – does this ailing 74-year old man have the energy to lead?
Back when Mr Buhari first went to London – in June 2016 – his office said it was for a persistent ear infection.
Image copyrightREUTERS
Image captionBuhari has now officially taken back power from Yemi Osinbajo (r)
An official statement released in March 2017 – following a longer spell away – said that the president ad been on “vacation, during which he had medical check-ups”.
His main opponents in Nigeria’s 2015 election had claimed he had prostate cancer – which he denied.