2 miscarriages this year😭

I am currently a mother of two children, we are trying for number 3 and I'm not being successful I got pregnant twice this year and they both ended at two months I am devastated. Is there anything I can do so I won't miscarry again ??