Dasuki left prison at roughly 9 p.m. (2000 GMT) on Tuesday and joined his family at his home in the Asokoro district of Abuja. Sowore was released earlier in the evening, greeting jubilant supporters.
"The two defendants are enjoined to observe the terms of their bail and refrain from engaging in any act that is inimical to public peace and national security as well as their ongoing trial which will run its course in accordance with the laws of the land," Attorney General and Justice Minister Abubakar Malami said in a statement.
The government has accused Dasuki, who served under former President Goodluck Jonathan, of fraud involving $68 million of defence spending. He has pleaded not guilty.
Dasuki has been granted bail several times but the government had refused to release him.