These array formulas will work.
If the dates fall within the same year you can use:
{=AVERAGE(IF(ISNUMBER(A1:A100),IF(MONTH(A1:A100)=MONTH(D4),B1:B100)))}
If they don't, you may want to include a year reference if you don't want your average to include last year's data for the same month.
{=AVERAGE(IF(ISNUMBER(A1:A100),IF((YEAR(A1:A100)=YEAR(D4))*(MONTH(A1:A100)=MONTH(D4)),B1:B100)))}
Where D4 contains a reference date.
Use Ctrl+Shift+Enter to get the brackets