I think the person that 'gifted' the money has to write it and you both sign it. I'm not too sure to be honest. Fortunately, I had enough to cover my closing costs in my bank account and have a 401K that they used for my reserves. If possible, when writing out a sales contract, push for the seller to pay between $2000-$3000 of your closing costs instead of trying to lower the price of the home by that amount. $3000 over 30 years does not do much to your monthly payment... but it may make a world of difference to FHA when calculating your money on hand.
Back to your question, I do know that there is a statement that has to be filed stating that under perjury of law, this money is a gift that does not need to be repaid. So I would assume that you and the person giving you the money write a letter and then fill out a form of some sort. That's the way I understood it as the lender was going over all my options.
FHA will generally do a loan up to 97% of the sales price. So if you are thinking of an FHA loan, you also need to be aware that the loan to income (or debt to income I should say) varies by state to state- but 41% seems to be the norm in most areas.
One thing I also found is that you have 15 days to shop around for a mortgage. So from the first mortgage app you put in.. you can have your credit checked by mortgage companies and it will only ding your credit once. I put in an app with about 8 different banks (Including FHA lenders) ,and my credit barely took a hit- until the mortgage showed up on the credit report!!!
Good luck! I switched lenders mid way, (went from conv to FHA) so I've got some recent experience with this.