You can petition him as soon as you are married. What needs to be done depends on how he entered the US.
You should retain an experienced immigration lawyer to review all the facts, advise you, and handle the case. You can find one through http://www.ailalawyer.com.
J Charles Ferrari Eng & Nishimura 213.622.2255 The statement above is general in nature and does not constitute legal advice, as not all the facts are known. You should retain an attorney to review all the facts specific to your case in order to receive advise specific to your case. The statement above does not create an attorney/client relationship. Answers on Avvo can only be general ones, as specific answers would require knowledge of all the facts. As such, they may or may not apply to the question.
The main question that needs to be answered here is how did your boyfriend enter the U.S.? (did he enter without inspection by an immigration officer?; did overstay his visa?) That, along with other relevant factors, will be determinative of the course of action to follow towards achieving the goal of permanent residency.