You can absolutely apply for an ESTA.
The real question is whether your ESTA will be approved, and realistically nobody can answer that other than you - by actually applying for one! During the ESTA application you will need to disclose that you has previously had a visa denied (The specific question is "Have you ever been denied a U.S. visa you applied for with your current or previous passport, or have you ever been refused admission to the United States or withdrawn your application for admission at a U.S. port of entry?"), however this will not in and of itself cause your ESTA to be refused.
If your ESTA is approved, then you can still potentially have issues at the border, and/or be admitted for a period shorter than you are asking for. There is no specific rule for how long you need to stay outside of the US between trips, but the general rule of thumb is that you need to be outside of the US for longer than you were in the US. The combination of many trips to the US, your previous warning about entering the US, and the fact you have a boyfriend in the US will almost certainly make Customs and Border Patrol officers suspicious that you may not plan to leave the US when your period of entry is over which increases the chances you will not be allowed entry - even with a valid ESTA.
As an aside, the maximum period you can stay in the US under the Visa Waiver Program is 90 days, which is NOT normally the same as 3 months. It's only a few days difference, but it can be an important distinction.