Mediocre/Poor letter of rec from well-known professor vs great letter from not as well-known professor? I'm planning to apply to graduate school next year after working a year in industry (software engineering) but have received advice to get my letters of recommendation and other application parts sorted out asap. 

I'm conflicted on who I should keep in contact with for letter-writing purposes-- a professor from a top-ranked school (I plan to apply to this school for  PhD) that I did a summer REU with after my sophomore year but that I didn't see very often and where I don't think I made any real contributions even though he said I was doing a good job (my impression was that he says that to everybody who does research for him). Part of the reason I don't think this would be a good letter was because I did a lot of the work from home (he recommended I do this since I was far and I had a medical condition that made it difficult to commute) so he didn't really get to see my day-to-day work. The work that I was doing was also largely grunt work like running simulations and writing programs to handle data.

On the other hand, I have close relationships with 3 professors at my institution (I attend a small non-research-focused institution):


1 of which is my advisor and I have taken 2 courses with
1 I did an independent study with and did really well in his class, which is largely related what I want to study in grad school
1 of which is new and I'll begin doing research with him soon but hence won't have much time to do research with since I'll be graduating soon (though I do plan to ask if I can continue to collaborate with him on research after I graduate)


I also did an REU (not a well-known school or professor) after my freshman year where my supervisor said that I would do "stunning work" in graduate school, so I could get a strong letter from him, but this was a long time ago so it probably doesn't carry much weight.

So my question is-- should I take a probably not great recommendation from a well-known professor, or strong recommendations from not very well-known professors who know me well and I've formed strong connections with more recently (junior/senior year versus summer after sophomore year). Will it raise flags if I don't seek out a letter from the well-known professor?
Always go for the recommendation from the professor who knows you better. A letter from Albert Einstein that goes "mayradio0508 was never late to class and has nice handwriting" will not carry any weight.

Having said that, it sounds like you underestimate what this professor will be able to say about you. Running simulations and writing programs to handle data is something you do in research! The professor has also said you did a good job, which is a good sign. Besides, of the other three options you mention, it sounds like none of them can comment on your research ability (the third one can, but you've not started doing research with him).

If you're concerned he won't be able to say something good about you, you could always ask him: "Prof so-and-so, will you be able to write me a strong recommendation letter?"