You can earn miles while you are booking hotels, for yourself and even for other people.
On booking.com you can earn 1 mile for 1€ spend if you are using the link of the partner Lufthansa with miles-and-more.
If you have signed up for British Airways Executive Club, then you can earn regularly 4 miles per 1£ spent. Sometimes even more like now 6M/1£ .
BA booking.com link
The best is, you can also book hotels for your family, friends, whoever, but you need to enter your loyalityID during the booking process.
Of course you can book other hotels through the BA shop with different miles per pound ratio.
There is also for example Rocketmiles where you can earn for many different programs, like BAEC, Alaska Airlines MP, United MileagePlus, Turkish Airlines MilesSmiles and many more.
Below are just few examples for 1 week in Toronto in march 2020.
Alasaka Milege Plan:
If you would like to earn more miles with Miles and More, then you can also book with their partner Points.com (Hotels&Cars by Points) where you get 1k miles per night.
Again same example as above.
The costs are per night, this below shows an extra 10k miles if you book your first hotel in october.
Until March 2020 you can earn extra miles with HotelsandCars for every 5th night.