All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah and that Muhammad is His slave and Messenger.
Depositing money in a savings account to be invested by the Islamic bank in return for a percentage of the profits is classified as a mudhaarabah contract (a profit sharing arrangement between two parties, that is, an investor and an entrepreneur; the investor will supply the entrepreneur with funds for his business venture and get a return on the funds that he puts into the business based on a profit sharing ratio that has been agreed on earlier, and losses suffered shall be borne by the capital provider) in the Islamic sharee'ah. The same religious rulings that apply to mudhaarabah apply to this transaction as well.
The resolution of the Council of the Islamic Fiqh Academy, affiliated to the Organization of the Islamic Conference (OIC) reads:
"B) Deposits made to banks that actually abide by the provisions of the Islamic sharee'ah by virtue of an investment contract in return for a percentage of the profits are held as mudhaarabah capital as per the sharee'ah, and the same rulings and provisions that apply to mudhaarabah apply to such deposits..." [Islamic Academy Journal]
Hence, when your friend deposits money to your bank account, he is acting as an investor in this mudhaarabah; he is entitled to a share of the profits according to the amount of money that he deposited. If you both deposited equal amounts, then the profits should be divided equally between you. If you deposited two-thirds of the amount and your friend deposited one-third, then he is entitled to one-third of the profits and you are entitled to two-thirds and so on.
Allaah knows best.